mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 10:20:08 +00:00
some refactoring...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
f5a6fc8c87
commit
6613f1fc5c
@ -165,17 +165,8 @@ function setupBookmarks(viewer){
|
||||
bookmarksUpdated()
|
||||
})
|
||||
.on('horizontalShiftedImage', function(evt, gid, direction){
|
||||
var n = DATA.order.indexOf(gid)
|
||||
var o = BOOKMARKS.indexOf(gid)
|
||||
|
||||
// move the marked gid...
|
||||
BOOKMARKS.splice(o, 1)
|
||||
BOOKMARKS.splice(n, 0, gid)
|
||||
|
||||
// test if there are any marked images between n and o...
|
||||
var shift = compactSparceList(BOOKMARKS.slice(Math.min(n, o)+1, Math.max(n, o)))
|
||||
if(shift.length > 0){
|
||||
marksUpdated()
|
||||
if(shiftGIDInSparseList(gid, BOOKMARKS)){
|
||||
bookmarksUpdated()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
27
ui/marks.js
27
ui/marks.js
@ -289,6 +289,22 @@ function shiftGIDToOrderInList(gid, direction, list){
|
||||
}
|
||||
return false
|
||||
}
|
||||
// a sparse version of shiftGIDToOrderInList(..)...
|
||||
function shiftGIDInSparseList(gid, list){
|
||||
var n = DATA.order.indexOf(gid)
|
||||
var o = list.indexOf(gid)
|
||||
|
||||
// move the marked gid...
|
||||
list.splice(o, 1)
|
||||
list.splice(n, 0, gid)
|
||||
|
||||
// test if there are any marked images between n and o...
|
||||
var shift = compactSparceList(list.slice(Math.min(n, o)+1, Math.max(n, o)))
|
||||
if(shift.length > 0){
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -775,16 +791,7 @@ function setupMarks(viewer){
|
||||
marksUpdated()
|
||||
})
|
||||
.on('horizontalShiftedImage', function(evt, gid, direction){
|
||||
var n = DATA.order.indexOf(gid)
|
||||
var o = MARKED.indexOf(gid)
|
||||
|
||||
// move the marked gid...
|
||||
MARKED.splice(o, 1)
|
||||
MARKED.splice(n, 0, gid)
|
||||
|
||||
// test if there are any marked images between n and o...
|
||||
var shift = compactSparceList(MARKED.slice(Math.min(n, o)+1, Math.max(n, o)))
|
||||
if(shift.length > 0){
|
||||
if(shiftGIDInSparseList(gid, MARKED)){
|
||||
marksUpdated()
|
||||
}
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user