some tweaking of the crop interface and made its use more consistent...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2013-08-08 23:19:28 +04:00
parent e8a18b2a55
commit af69c5489d
3 changed files with 22 additions and 12 deletions

View File

@ -1222,9 +1222,17 @@ function uncropData(){
return DATA
}
var prev_state = DATA
var cur = DATA.current
DATA = CROP_STACK.pop()
// check if cur exists in data being loaded...
if($.map(DATA.ribbons,
function(e, i){ return e.indexOf(cur) >= 0 }).indexOf(true) >= 0){
// keep the current position...
DATA.current = cur
}
reloadViewer()
updateImages()

View File

@ -20,21 +20,21 @@ function cropMarkedImages(cmp, no_cleanout_marks){
cmp = cmp == null ? imageOrderCmp : cmp
var cur = DATA.current
var marked = MARKED.slice().sort(cmp)
// this will ignore any gid in marks that is not in IMAGES...
// NOTE: if IMAGES contains only part of the data loadable this will
// be wrong...
if(!no_cleanout_marks){
for(var i=0; i < marked.length;){
if(marked[i] in IMAGES){
i++
continue
}
// NOTE: we do not need to advance i here...
marked.splice(i, 1)
}
// build all loaded images cache...
var loaded = []
$.each(DATA.ribbons, function(i, e){ loaded = loaded.concat(e) })
// ignore any gid in marks that is not in IMAGES...
// NOTE: if IMAGES contains only part of the data loadable this will
// be wrong...
var marked = marked.filter(function(e){
return e in IMAGES && loaded.indexOf(e) >= 0
})
}
ALL_DATA = cropDataTo(marked)
cropDataTo(marked)
return DATA
}
@ -45,6 +45,7 @@ function cropMarkedImages(cmp, no_cleanout_marks){
* Modes
*/
// XXX is this a mode???
var toggleMarkedOnlyView = createCSSClassToggler(
'.viewer',
'marked-only-view cropped-mode',

View File

@ -172,6 +172,7 @@ var toggleSingleImageMode = createCSSClassToggler(
// XXX make this not conflict with marked-only-mode, better yet, make them
// one single mode...
// XXX is this a mode???
var toggleSingleRibbonMode = createCSSClassToggler(
'.viewer',
'single-ribbon-mode cropped-mode',