several bug fixes and cleanup...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2014-11-20 05:08:47 +03:00
parent 7970a23c31
commit 82cd756fd9
2 changed files with 18 additions and 5 deletions

View File

@ -1958,12 +1958,16 @@ var DataWithTagsPrototype = {
// get tag state...
} else if(action == '?'){
if(this.tags == null){
return gids.map(function(gid){ return 'off' })
return gids.length > 1 ? gids.map(function(gid){ return 'off' }) : 'off'
}
var that = this
var tagset = this.tags
var order = this.order
var res = gids.map(function(gid){
gid = that.getImage(gid)
if(!(tag in tagset)){
return 'off'
}
//return that.getTags(gid).indexOf(tag) != -1 ? 'on' : 'off'
return tagset[tag][order.indexOf(gid)] != null ? 'on' : 'off'
})
@ -1974,8 +1978,9 @@ var DataWithTagsPrototype = {
var tagset = this.tags
var order = this.order
var res = gids.map(function(gid){
gid = that.getImage(gid)
//var t = that.getTags(gid).indexOf(tag) != -1 ? 'off' : 'on'
var t = tagset == null ? 'on'
var t = tagset == null || !(tag in tagset) ? 'on'
: tagset[tag][order.indexOf(gid)] == null ? 'on'
: 'off'
if(t == 'on'){

View File

@ -1779,6 +1779,11 @@ var ImageMarkActions = actions.Actions({
// XXX make this a real toggler... ???
toggleMark: ['',
function(target, action){
if(target == '?' || target == 'on' || target == 'off'){
var x = action
action = target
target = x
}
target = target || 'current'
target = target == 'all'
|| target == 'loaded'
@ -1790,17 +1795,20 @@ var ImageMarkActions = actions.Actions({
var res = this.data.toggleTag('selected', target, action)
if(this.ribbons != null){
if(action != '?' && this.ribbons != null){
var that = this
target.forEach(function(t){
that.ribbons.toggleImageMark(t, 'selected', action)
})
}
return res
return res
}],
toggleMarkBlock: ['',
function(){
function(target){
var cur = this.toggleMark(target, '?')
// get all the next/prev gids until we get a state other than cur...
// XXX
}],