mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 18:30:09 +00:00
cleanup + fixes...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
b5d11192ac
commit
ed68854c80
@ -207,12 +207,29 @@ module.ImageMarks = core.ImageGridFeatures.Feature({
|
|||||||
|
|
||||||
tag: 'image-marks',
|
tag: 'image-marks',
|
||||||
|
|
||||||
depends: ['base'],
|
depends: [
|
||||||
|
'base'
|
||||||
|
],
|
||||||
|
suggested: [
|
||||||
|
'ui-image-marks',
|
||||||
|
],
|
||||||
|
|
||||||
actions: ImageMarkActions,
|
actions: ImageMarkActions,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
var ImageMarksUI =
|
||||||
|
module.ImageMarksUI = core.ImageGridFeatures.Feature({
|
||||||
|
title: '',
|
||||||
|
doc: '',
|
||||||
|
|
||||||
|
tag: 'ui-image-marks',
|
||||||
|
|
||||||
|
depends: [
|
||||||
|
'ui'
|
||||||
|
],
|
||||||
|
|
||||||
handlers: [
|
handlers: [
|
||||||
// obey the shiftImage protocol...
|
|
||||||
[[
|
[[
|
||||||
'shiftMarkedUp.pre',
|
'shiftMarkedUp.pre',
|
||||||
'shiftMarkedDown.pre',
|
'shiftMarkedDown.pre',
|
||||||
@ -222,14 +239,14 @@ module.ImageMarks = core.ImageGridFeatures.Feature({
|
|||||||
var marked = this.markedInRibbon(ribbon)
|
var marked = this.markedInRibbon(ribbon)
|
||||||
|
|
||||||
// need to shift focus...
|
// need to shift focus...
|
||||||
|
// XXX this still results in odd alignment problems in some cases...
|
||||||
if(marked.indexOf(this.current) >= 0){
|
if(marked.indexOf(this.current) >= 0){
|
||||||
var l = this.ribbons.getRibbonLocator()
|
|
||||||
var direction = this.direction == 'right' ? 'next' : 'prev'
|
var direction = this.direction == 'right' ? 'next' : 'prev'
|
||||||
|
|
||||||
var getNext = function(direction){
|
var getNext = function(direction){
|
||||||
var next = that.data.getImage(direction)
|
var next = that.data.getImage(direction)
|
||||||
while(next != null && marked.indexOf(next) >= 0){
|
while(next != null && marked.indexOf(next) >= 0){
|
||||||
next = that.data.getImage(direction)
|
next = that.data.getImage(next, direction)
|
||||||
}
|
}
|
||||||
return next
|
return next
|
||||||
}
|
}
|
||||||
@ -237,6 +254,7 @@ module.ImageMarks = core.ImageGridFeatures.Feature({
|
|||||||
var next = getNext(direction)
|
var next = getNext(direction)
|
||||||
|| getNext(direction == 'next' ? 'prev' : 'next')
|
|| getNext(direction == 'next' ? 'prev' : 'next')
|
||||||
|
|
||||||
|
var l = this.ribbons.getRibbonLocator()
|
||||||
next != null
|
next != null
|
||||||
&& this.ribbons.preventTransitions(l)
|
&& this.ribbons.preventTransitions(l)
|
||||||
&& this.focusImage(next)
|
&& this.focusImage(next)
|
||||||
@ -261,7 +279,6 @@ module.ImageMarks = core.ImageGridFeatures.Feature({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
|
|
||||||
var ImageBookmarkActions = actions.Actions({
|
var ImageBookmarkActions = actions.Actions({
|
||||||
|
|||||||
@ -89,11 +89,16 @@ function updateImagePosition(actions, target){
|
|||||||
|
|
||||||
return function(){
|
return function(){
|
||||||
actions.ribbons.preventTransitions(s)
|
actions.ribbons.preventTransitions(s)
|
||||||
|
var end = function(){
|
||||||
|
// XXX not sure why this does not work without a setTimeout(..)
|
||||||
|
//actions.ribbons.restoreTransitions(s, true)
|
||||||
|
setTimeout(function(){
|
||||||
|
actions.ribbons.restoreTransitions(s, true) }, 0) }
|
||||||
|
|
||||||
// XXX hack...
|
// XXX hack???
|
||||||
if(target.constructor === Array){
|
if(target instanceof Array){
|
||||||
actions.reload()
|
actions.reload()
|
||||||
return
|
return end()
|
||||||
}
|
}
|
||||||
|
|
||||||
var target_ribbon = actions.data.getRibbon(target)
|
var target_ribbon = actions.data.getRibbon(target)
|
||||||
@ -101,7 +106,7 @@ function updateImagePosition(actions, target){
|
|||||||
// nothing changed...
|
// nothing changed...
|
||||||
if(source_ribbon == target_ribbon
|
if(source_ribbon == target_ribbon
|
||||||
&& actions.data.getImageOrder(target) == source_order){
|
&& actions.data.getImageOrder(target) == source_order){
|
||||||
return
|
return end()
|
||||||
}
|
}
|
||||||
|
|
||||||
// place image at position...
|
// place image at position...
|
||||||
@ -134,10 +139,7 @@ function updateImagePosition(actions, target){
|
|||||||
|
|
||||||
actions.focusImage()
|
actions.focusImage()
|
||||||
|
|
||||||
// XXX not sure why this does not work without a setTimeout(..)
|
return end()
|
||||||
//actions.ribbons.restoreTransitions(s, true)
|
|
||||||
setTimeout(function(){
|
|
||||||
actions.ribbons.restoreTransitions(s, true) }, 0)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -880,15 +882,6 @@ module.ViewerActions = actions.Actions({
|
|||||||
fitScreen: ['Zoom/Fit image to screen',
|
fitScreen: ['Zoom/Fit image to screen',
|
||||||
function(){ this.screenfit = 1 }],
|
function(){ this.screenfit = 1 }],
|
||||||
|
|
||||||
// NOTE: these work by getting the target position from .data...
|
|
||||||
/*
|
|
||||||
shiftImageTo: [
|
|
||||||
function(target){ return updateImagePosition(this, target) }],
|
|
||||||
shiftImageUp: [
|
|
||||||
function(target){ return updateImagePosition(this, target) }],
|
|
||||||
shiftImageDown: [
|
|
||||||
function(target){ return updateImagePosition(this, target) }],
|
|
||||||
//*/
|
|
||||||
shiftImageLeft: [
|
shiftImageLeft: [
|
||||||
function(target){ this.ribbons.placeImage(target, -1) }],
|
function(target){ this.ribbons.placeImage(target, -1) }],
|
||||||
shiftImageRight: [
|
shiftImageRight: [
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user