added unsorted tag handling...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2013-12-17 04:55:02 +04:00
parent 4410852f50
commit 66470c5ecb
3 changed files with 33 additions and 6 deletions

View File

@ -528,7 +528,7 @@ function setBaseURL(url){
function getBaseRibbonIndex(){
// XXX
console.warn('Base ribbon API is still a stub...')
//console.warn('Base ribbon API is still a stub...')
return 0
}
@ -536,7 +536,7 @@ function setBaseRibbonIndex(n){
n = n == null ? 0 : n
// XXX
console.warn('Base ribbon API is still a stub...')
//console.warn('Base ribbon API is still a stub...')
return n
}

View File

@ -314,6 +314,7 @@ function toggleMarkBlock(image){
function shiftMarkedImages(direction, mode, new_ribbon){
mode = mode == null ? 'ribbon' : mode
var cur = getRibbonIndex()
var orig_ribbon = cur
// ribbon only...
if(mode == 'ribbon'){
@ -362,6 +363,8 @@ function shiftMarkedImages(direction, mode, new_ribbon){
DATA.ribbons = DATA.ribbons.filter(function(e){ return e.length > 0 ? true : false })
updateRibbonOrder()
$('.viewer').trigger('shiftedImages', [marked, orig_ribbon, cur])
}
function shiftMarkedImagesUp(mode, new_ribbon){
return shiftMarkedImages('prev', mode, new_ribbon)

View File

@ -4,6 +4,9 @@
*
**********************************************************************/
// NOTE: if this is set to null the feature will be disabled...
var UNSORTED_TAG = 'unsorted'
// Tag index
//
// This can be constructed from tags in IMAGES with buildTagsFromImages(..)
@ -300,7 +303,7 @@ function cropTagged(tags, cmp, keep_ribbons, keep_unloaded_gids){
function setupTags(viewer){
console.log('Tags: setup...')
viewer
return viewer
.on('imagesLoaded', function(){
TAGS = []
@ -313,14 +316,35 @@ function setupTags(viewer){
showStatusQ('Tags: Index: done ('+( t1 - t0 )+'ms).')
})
.on('aligningRibbonsSection', function(base, gids){
untagList(gids, 'unsorted')
})
}
SETUP_BINDINGS.push(setupTags)
function setupUnsortedTagHandler(viewer){
console.log('Tags: "'+UNSORTED_TAG+'" tag handling: setup...')
return viewer
// unsorted tag handling...
.on('shiftedImage', function(evt, img){
if(UNSORTED_TAG != null){
removeTag(UNSORTED_TAG, getImageGID(img))
}
})
.on('shiftedImages', function(evt, gids){
if(UNSORTED_TAG != null){
untagList(gids, UNSORTED_TAG)
}
})
.on('aligningRibbonsSection', function(evt, base, gids){
if(UNSORTED_TAG != null){
untagList(gids, UNSORTED_TAG)
}
})
}
SETUP_BINDINGS.push(setupUnsortedTagHandler)
/**********************************************************************
* vim:set ts=4 sw=4 : */