mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 18:30:09 +00:00
fixed several bugs...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
5888442b71
commit
9892d26b0a
@ -109,8 +109,9 @@ Roadmap
|
|||||||
|
|
||||||
|
|
||||||
[_] 32% Gen 3 current todo
|
[_] 32% Gen 3 current todo
|
||||||
[_] 64% High priority
|
[_] 65% High priority
|
||||||
[_] BUG: sorting (dialog) will mess up the order...
|
[_] make buildcache sort images via data AND file name...
|
||||||
|
[X] BUG: sorting (dialog) will mess up the order...
|
||||||
| Procedure:
|
| Procedure:
|
||||||
| - shift-s + sort in a way that changes the order
|
| - shift-s + sort in a way that changes the order
|
||||||
| - move next till the spot where the order changed
|
| - move next till the spot where the order changed
|
||||||
@ -123,7 +124,7 @@ Roadmap
|
|||||||
| Workaround:
|
| Workaround:
|
||||||
| - sort, save, then F5
|
| - sort, save, then F5
|
||||||
|
|
|
|
||||||
[_] BUG: sorting breaks when at or near the end of a ribbon...
|
[X] BUG: sorting breaks when at or near the end of a ribbon...
|
||||||
|
|
|
|
||||||
| Race condition...
|
| Race condition...
|
||||||
|
|
|
|
||||||
@ -560,6 +561,7 @@ Roadmap
|
|||||||
| drops to last placeholder
|
| drops to last placeholder
|
||||||
|
|
|
|
||||||
[_] single image mode transition (alpha-blend/fade/none)
|
[_] single image mode transition (alpha-blend/fade/none)
|
||||||
|
[X] BUG: shifting image left/right marks and bookmarks it...
|
||||||
[X] Might be a good idea to use sparse arrays for things like marks...
|
[X] Might be a good idea to use sparse arrays for things like marks...
|
||||||
| eliminate:
|
| eliminate:
|
||||||
| - need for keeping things sorted all the time
|
| - need for keeping things sorted all the time
|
||||||
|
|||||||
@ -175,8 +175,8 @@ function setupBookmarks(viewer){
|
|||||||
BOOKMARKS = populateSparceGIDList(BOOKMARKS)
|
BOOKMARKS = populateSparceGIDList(BOOKMARKS)
|
||||||
bookmarksUpdated()
|
bookmarksUpdated()
|
||||||
})
|
})
|
||||||
.on('horizontalShiftedImage', function(evt, gid, direction){
|
.on('horizontalShiftedImage', function(evt, gid, direction, from, to){
|
||||||
if(shiftGIDInSparseList(gid, BOOKMARKS)){
|
if(shiftGIDInSparseList(gid, from, to, BOOKMARKS)){
|
||||||
bookmarksUpdated()
|
bookmarksUpdated()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -2181,6 +2181,8 @@ function updateImages(list, size, cmp){
|
|||||||
//
|
//
|
||||||
// This is similar to getGIDsAround(..) but will load images into the
|
// This is similar to getGIDsAround(..) but will load images into the
|
||||||
// viewer...
|
// viewer...
|
||||||
|
//
|
||||||
|
// XXX make a smarter common section handling...
|
||||||
function loadImagesAround(count, gid, ribbon, data, force_count, ignore_common_sections){
|
function loadImagesAround(count, gid, ribbon, data, force_count, ignore_common_sections){
|
||||||
// default values...
|
// default values...
|
||||||
data = data == null ? DATA : data
|
data = data == null ? DATA : data
|
||||||
@ -2320,6 +2322,9 @@ function rollImages(n, ribbon, extend, no_compensate_shift){
|
|||||||
// structure and do a fast reload
|
// structure and do a fast reload
|
||||||
// NOTE: if the order of images has changed, reuse_current_structure must
|
// NOTE: if the order of images has changed, reuse_current_structure must
|
||||||
// be null or false, otherwise this will not produce a correct result.
|
// be null or false, otherwise this will not produce a correct result.
|
||||||
|
//
|
||||||
|
// XXX reuse_current_structure will not work correctly until loadImagesAround(..)
|
||||||
|
// ignores section content...
|
||||||
function reloadViewer(reuse_current_structure, images_per_screen){
|
function reloadViewer(reuse_current_structure, images_per_screen){
|
||||||
var ribbons_set = $('.ribbon-set')
|
var ribbons_set = $('.ribbon-set')
|
||||||
var current = DATA.current
|
var current = DATA.current
|
||||||
@ -2413,7 +2418,7 @@ function updateRibbonOrder(no_reload_viewer){
|
|||||||
DATA.ribbons[i] = fastSortGIDsByOrder(DATA.ribbons[i])
|
DATA.ribbons[i] = fastSortGIDsByOrder(DATA.ribbons[i])
|
||||||
}
|
}
|
||||||
if(!no_reload_viewer){
|
if(!no_reload_viewer){
|
||||||
reloadViewer(true)
|
reloadViewer(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
34
ui/marks.js
34
ui/marks.js
@ -279,21 +279,31 @@ function shiftGIDToOrderInList(gid, direction, list){
|
|||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// a sparse version of shiftGIDToOrderInList(..)...
|
// a sparse version of shiftGIDToOrderInList(..)...
|
||||||
function shiftGIDInSparseList(gid, list){
|
//
|
||||||
var n = DATA.order.indexOf(gid)
|
// returns true if list is updated....
|
||||||
var o = list.indexOf(gid)
|
function shiftGIDInSparseList(gid, from, to, list){
|
||||||
|
if(list[from] == null && list[to] == null){
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
var cleanup = list.indexOf(gid) < 0
|
||||||
|
|
||||||
// move the marked gid...
|
// move the marked gid...
|
||||||
list.splice(o, 1)
|
list.splice(from, 1)
|
||||||
list.splice(n, 0, gid)
|
list.splice(to, 0, gid)
|
||||||
|
|
||||||
// test if there are any marked images between n and o...
|
// if gid was never in list, we must remove leave things as we got
|
||||||
var shift = compactSparceList(list.slice(Math.min(n, o)+1, Math.max(n, o)))
|
// them, and remove it again...
|
||||||
if(shift.length > 0){
|
// NOTE: essentially, we are using gid as a marker, as we can't
|
||||||
return true
|
// .splice(..) an undefined into a list...
|
||||||
|
if(cleanup){
|
||||||
|
delete list[to]
|
||||||
}
|
}
|
||||||
return false
|
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -787,8 +797,8 @@ function setupMarks(viewer){
|
|||||||
MARKED = populateSparceGIDList(MARKED)
|
MARKED = populateSparceGIDList(MARKED)
|
||||||
marksUpdated()
|
marksUpdated()
|
||||||
})
|
})
|
||||||
.on('horizontalShiftedImage', function(evt, gid, direction){
|
.on('horizontalShiftedImage', function(evt, gid, direction, from, to){
|
||||||
if(shiftGIDInSparseList(gid, MARKED)){
|
if(shiftGIDInSparseList(gid, from, to, MARKED)){
|
||||||
marksUpdated()
|
marksUpdated()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -360,9 +360,12 @@ function horizontalShiftImage(image, direction){
|
|||||||
// NOTE: in a race condition this may still overwrite the order someone
|
// NOTE: in a race condition this may still overwrite the order someone
|
||||||
// else is working on, the data will be consistent...
|
// else is working on, the data will be consistent...
|
||||||
var order = DATA.order.slice()
|
var order = DATA.order.slice()
|
||||||
order.splice(order.indexOf(gid), 1)
|
var from = order.indexOf(gid)
|
||||||
|
order.splice(from, 1)
|
||||||
order.splice(order.indexOf(target) + (direction == 'next'? 1 : 0), 0, gid)
|
order.splice(order.indexOf(target) + (direction == 'next'? 1 : 0), 0, gid)
|
||||||
|
var to = order.indexOf(gid)
|
||||||
// do the dirty work...
|
// do the dirty work...
|
||||||
|
// ...replace the order with the new order...
|
||||||
DATA.order.splice.apply(DATA.order, [0, DATA.order.length].concat(order))
|
DATA.order.splice.apply(DATA.order, [0, DATA.order.length].concat(order))
|
||||||
|
|
||||||
// just update the ribbons, no reloading needed...
|
// just update the ribbons, no reloading needed...
|
||||||
@ -375,7 +378,7 @@ function horizontalShiftImage(image, direction){
|
|||||||
updateImages()
|
updateImages()
|
||||||
dataUpdated()
|
dataUpdated()
|
||||||
|
|
||||||
$('.viewer').trigger('horizontalShiftedImage', [gid, direction])
|
$('.viewer').trigger('horizontalShiftedImage', [gid, direction, from, to])
|
||||||
|
|
||||||
return image
|
return image
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user