mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 18:30:09 +00:00
fixed crop bug -- turned out to be a dependency leak in getGIDBefore(...) that got the current ribbon form DOM, implicitly requering DOM and data to be in sync which is conceptually wrong...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
ab976b256c
commit
62fe751973
@ -132,6 +132,7 @@ function getRibbon(image){
|
||||
}
|
||||
|
||||
|
||||
// XXX make this not depend on DOM... a-la getImageBefore vs. getGIDBefore
|
||||
// NOTE: elem is optional and if given can be an image or a ribbon...
|
||||
function getRibbonIndex(elem){
|
||||
if(elem == null){
|
||||
|
||||
19
ui/data.js
19
ui/data.js
@ -521,14 +521,29 @@ function normalizePath(url, base, mode){
|
||||
}
|
||||
|
||||
|
||||
// like getRibbonIndex but get the index only via DATA...
|
||||
function getDataRibbonIndex(gid, data){
|
||||
gid = gid == null ? getImageGID() : gid
|
||||
data = data == null ? DATA : data
|
||||
|
||||
for(var i=0; i < data.ribbons.length; i++){
|
||||
if(data.ribbons[i].indexOf(gid) >= 0){
|
||||
return i
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
// Same as getImageBefore(...), but uses gids and searches in DATA...
|
||||
//
|
||||
// NOTE: this uses it's own predicate...
|
||||
function getGIDBefore(gid, ribbon, search, data){
|
||||
gid = gid == null ? getImageGID() : gid
|
||||
ribbon = ribbon == null ? getRibbonIndex() : ribbon
|
||||
search = search == null ? binSearch : search
|
||||
data = data == null ? DATA : data
|
||||
// XXX get a ribbon without getting into DOM...
|
||||
// ...dependency leek...
|
||||
ribbon = ribbon == null ? getDataRibbonIndex(gid, data) : ribbon
|
||||
search = search == null ? binSearch : search
|
||||
//search = search == null ? match2(linSearch, binSearch) : search
|
||||
ribbon = data.ribbons[ribbon]
|
||||
var order = data.order
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user