started work on flipping...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2013-06-04 16:32:33 +04:00
parent 6dcc86540b
commit 09675e12b4
7 changed files with 734 additions and 695 deletions

View File

@ -877,27 +877,79 @@ function rotateImage(direction, image){
}) })
$('.viewer').trigger('rotating' + direction.capitalize(), [image]) $('.viewer').trigger('rotating' + direction.capitalize(), [image])
return image
} }
function rotateLeft(image){ function rotateLeft(image){
rotateImage('left', image) return rotateImage('left', image)
} }
function rotateRight(image){ function rotateRight(image){
rotateImage('right', image) return rotateImage('right', image)
} }
/******************************************************** Flipping ***/ /******************************************************** Flipping ***/
function flipVertical(image){ function getImageFlipState(image){
// XXX image = image == null ? getImage() : $(image)
var state = image.attr('flipped')
if(state == null){
return []
}
state = state.split(',').map(function(e){ return e.trim() })
return state
}
function setImageFlipState(image, state){
image = image == null ? getImage() : $(image)
if(state.length == 0){
image.removeAttr('flipped')
} else if(state != null){
image.attr('flipped', state.join(', '))
}
return image
}
// XXX not yet implemented...
// ...mostly because it will conflict with turning and require a
// very tightly woven with rotation code, both JS and CSS...
// i.e. requiring two sets of rotation styles, one for flipped
// and another for horizontally flipped image.
// ...at least flipping will not affect the square/viewer aspect
// ratio of images.
function flipImage(direction, image){
image = image == null ? getImage() : $(image)
image.each(function(i, e){
var img = $(this)
var state = getImageFlipState(img)
var i = state.indexOf(direction)
if(i >= 0){
state.splice(i, 1)
} else {
state.push(direction)
}
setImageFlipState(image, state)
})
$('.viewer').trigger('flipping' + direction.capitalize(), [image])
return image
} }
function flipVertical(image){
return flipImage('vertical')
}
function flipHorizontal(image){ function flipHorizontal(image){
// XXX return flipImage('horizontal')
} }

View File

@ -1425,6 +1425,8 @@ function updateRibbonsFromFavDirs(){
* Actions... * Actions...
*/ */
/******************************************************** Extension **/
// Open image in an external editor/viewer // Open image in an external editor/viewer
// //
// NOTE: this will open the default editor/viewer. // NOTE: this will open the default editor/viewer.
@ -1438,6 +1440,9 @@ function openImage(){
} }
/********************************************************** Sorting **/
function reverseImageOrder(){ function reverseImageOrder(){
DATA.order.reverse() DATA.order.reverse()
updateRibbonOrder() updateRibbonOrder()
@ -1466,6 +1471,9 @@ function sortImagesByName(reverse){
} }
/*************************************************** Manual sorting **/
// Ordering images... // Ordering images...
// NOTE: this a bit more complicated than simply shifting an image // NOTE: this a bit more complicated than simply shifting an image
// left/right the DATA.order, we have to put it before or after // left/right the DATA.order, we have to put it before or after

View File

@ -4,6 +4,8 @@
<link rel="stylesheet" href="layout.css"> <link rel="stylesheet" href="layout.css">
<!-- use only for devel... -->
<link rel="stylesheet/less" href="layout.less">
<style> <style>
@ -12,6 +14,38 @@
</style> </style>
<script>
less = {
// or "production"
env: "development",
// load imports async
async: false,
// load imports async when in a page under
// a file protocol
fileAsync: false,
// when in watch mode, time in ms between polls
//poll: 1000,
// user functions, keyed by name
//functions: {},
// or "mediaQuery" or "all"
//dumpLineNumbers: "comments",
// whether to adjust url's to be relative
// if false, url's are already relative to the
// entry less file
//relativeUrls: false,
// a path to add on to the start of every url
//resource
//rootpath: ":/a.com/"
}
</script>
<script src="ext-lib/less.js"></script>
<script src="ext-lib/jquery.js"></script> <script src="ext-lib/jquery.js"></script>
<script src="lib/jli.js"></script> <script src="lib/jli.js"></script>

File diff suppressed because it is too large Load Diff

View File

@ -122,18 +122,10 @@ body {
.rotate(90deg); .rotate(90deg);
} }
.image[orientation="180"] { .image[orientation="180"] {
-webkit-transform: rotate(180deg); .rotate(180deg);
-moz-transform: rotate(180deg);
-o-transform: rotate(180deg);
-ms-transform: rotate(180deg);
transform: rotate(180deg);
} }
.image[orientation="270"] { .image[orientation="270"] {
-webkit-transform: rotate(270deg); .rotate(270deg);
-moz-transform: rotate(270deg);
-o-transform: rotate(270deg);
-ms-transform: rotate(270deg);
transform: rotate(270deg);
} }

View File

@ -16,7 +16,7 @@ function setupIndicators(){
.click(function(){ toggleMarkesView() }) .click(function(){ toggleMarkesView() })
showGlobalIndicator( showGlobalIndicator(
'marked-only-visible', 'marked-only-visible',
'Marked only images visible (alt-F2)') 'Marked only images visible (shift-F2)')
.css('cursor', 'hand') .css('cursor', 'hand')
.click(function(){ toggleMarkedOnlyView() }) .click(function(){ toggleMarkedOnlyView() })

View File

@ -175,9 +175,15 @@ function updateStatus(message){
// Same as updateInfo(...) but will aslo show and animate-close the message // Same as updateInfo(...) but will aslo show and animate-close the message
//
// XXX the next call will not reset the animation of the previous, rather
// it will pause it and rezume...
// ...not sure if this is correct.
function showStatus(message){ function showStatus(message){
return updateStatus.apply(null, arguments) return updateStatus.apply(null, arguments)
.stop() //.stop()
.stop(true, false)
//.finish()
.show() .show()
.delay(500) .delay(500)
.fadeOut(800) .fadeOut(800)
@ -193,7 +199,9 @@ function showErrorStatus(message){
message.splice(0, 0, 'Error:') message.splice(0, 0, 'Error:')
return updateStatus.apply(null, message) return updateStatus.apply(null, message)
.one('click', function(){ $(this).fadeOut() }) .one('click', function(){ $(this).fadeOut() })
.stop() //.stop()
.stop(true, false)
//.finish()
.show() .show()
} }