now image flip state is saved and loaded...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2013-06-04 22:01:41 +04:00
parent f8bc4b41a8
commit 4dbfe77fd2
4 changed files with 39 additions and 7 deletions

View File

@ -917,13 +917,9 @@ function setImageFlipState(image, state){
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.
// direction can be:
// - 'vertical'
// - 'horizontal'
function flipImage(direction, image){
image = image == null ? getImage() : $(image)
image.each(function(i, e){

View File

@ -55,12 +55,24 @@ var STUB_IMAGE_DATA = {
classes: '',
// Image orientation
//
// can be:
// - 0 (default) - load as-is
// - 90 - rotate 90deg CW
// - 180 - rotate 180deg CW
// - 270 - rotate 270deg CW (90deg CCW)
orientation: 0,
// Image flip state
//
// can be:
// - null/undefined
// - array
//
// can contain:
// - 'vertical'
// - 'horizontal'
flipped: null,
}
// Data format...
@ -751,6 +763,11 @@ function updateImage(image, gid, size){
orientation: img_data.orientation == null ? 0 : img_data.orientation,
})
// flip...
if(img_data.flipped != null){
setImageFlipState(image, img_data.flipped)
}
// marks...
if(MARKED.indexOf(gid) != -1){
image.addClass('marked')

View File

@ -42,6 +42,9 @@ function updateGlobalImageInfo(image){
'<span class="shown">R</span>'+
'<span class="hidden"><b>R</b>otated: '+orientation+'&deg;CW</span>') : ''
// XXX
//var flip = data.flip
meta = meta.join(', ')
meta = meta != '' ? '( '+ meta +' )' : ''

View File

@ -186,6 +186,20 @@ function setupDataBindings(viewer){
}
})
})
.on('flippingVertical flippingHorizontal', function(evt, image){
$(image).each(function(i, e){
var img = $(this)
var gid = getImageGID(img)
var flip = getImageFlipState(img)
// change the image orientation status and add to
// updated list...
IMAGES[gid].flipped = flip
if(IMAGES_UPDATED.indexOf(gid) == -1){
IMAGES_UPDATED.push(gid)
}
})
})
// marks...
@ -250,6 +264,8 @@ function setupDataBindings(viewer){
'focusingImage',
'rotatingLeft',
'rotateingRight',
'flippingVertical',
'flippingHorizontal',
'togglingMark'
].join(' '),
function(evt, image){