mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-30 02:40:08 +00:00
now image flip state is saved and loaded...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
f8bc4b41a8
commit
4dbfe77fd2
10
ui/base.js
10
ui/base.js
@ -917,13 +917,9 @@ function setImageFlipState(image, state){
|
|||||||
return image
|
return image
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX not yet implemented...
|
// direction can be:
|
||||||
// ...mostly because it will conflict with turning and require a
|
// - 'vertical'
|
||||||
// very tightly woven with rotation code, both JS and CSS...
|
// - 'horizontal'
|
||||||
// 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){
|
function flipImage(direction, image){
|
||||||
image = image == null ? getImage() : $(image)
|
image = image == null ? getImage() : $(image)
|
||||||
image.each(function(i, e){
|
image.each(function(i, e){
|
||||||
|
|||||||
17
ui/data.js
17
ui/data.js
@ -55,12 +55,24 @@ var STUB_IMAGE_DATA = {
|
|||||||
classes: '',
|
classes: '',
|
||||||
|
|
||||||
// Image orientation
|
// Image orientation
|
||||||
|
//
|
||||||
// can be:
|
// can be:
|
||||||
// - 0 (default) - load as-is
|
// - 0 (default) - load as-is
|
||||||
// - 90 - rotate 90deg CW
|
// - 90 - rotate 90deg CW
|
||||||
// - 180 - rotate 180deg CW
|
// - 180 - rotate 180deg CW
|
||||||
// - 270 - rotate 270deg CW (90deg CCW)
|
// - 270 - rotate 270deg CW (90deg CCW)
|
||||||
orientation: 0,
|
orientation: 0,
|
||||||
|
|
||||||
|
// Image flip state
|
||||||
|
//
|
||||||
|
// can be:
|
||||||
|
// - null/undefined
|
||||||
|
// - array
|
||||||
|
//
|
||||||
|
// can contain:
|
||||||
|
// - 'vertical'
|
||||||
|
// - 'horizontal'
|
||||||
|
flipped: null,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Data format...
|
// Data format...
|
||||||
@ -751,6 +763,11 @@ function updateImage(image, gid, size){
|
|||||||
orientation: img_data.orientation == null ? 0 : img_data.orientation,
|
orientation: img_data.orientation == null ? 0 : img_data.orientation,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// flip...
|
||||||
|
if(img_data.flipped != null){
|
||||||
|
setImageFlipState(image, img_data.flipped)
|
||||||
|
}
|
||||||
|
|
||||||
// marks...
|
// marks...
|
||||||
if(MARKED.indexOf(gid) != -1){
|
if(MARKED.indexOf(gid) != -1){
|
||||||
image.addClass('marked')
|
image.addClass('marked')
|
||||||
|
|||||||
@ -42,6 +42,9 @@ function updateGlobalImageInfo(image){
|
|||||||
'<span class="shown">R</span>'+
|
'<span class="shown">R</span>'+
|
||||||
'<span class="hidden"><b>R</b>otated: '+orientation+'°CW</span>') : ''
|
'<span class="hidden"><b>R</b>otated: '+orientation+'°CW</span>') : ''
|
||||||
|
|
||||||
|
// XXX
|
||||||
|
//var flip = data.flip
|
||||||
|
|
||||||
|
|
||||||
meta = meta.join(', ')
|
meta = meta.join(', ')
|
||||||
meta = meta != '' ? '( '+ meta +' )' : ''
|
meta = meta != '' ? '( '+ meta +' )' : ''
|
||||||
|
|||||||
16
ui/setup.js
16
ui/setup.js
@ -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...
|
// marks...
|
||||||
@ -250,6 +264,8 @@ function setupDataBindings(viewer){
|
|||||||
'focusingImage',
|
'focusingImage',
|
||||||
'rotatingLeft',
|
'rotatingLeft',
|
||||||
'rotateingRight',
|
'rotateingRight',
|
||||||
|
'flippingVertical',
|
||||||
|
'flippingHorizontal',
|
||||||
'togglingMark'
|
'togglingMark'
|
||||||
].join(' '),
|
].join(' '),
|
||||||
function(evt, image){
|
function(evt, image){
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user