diff --git a/ui (gen4)/data.js b/ui (gen4)/data.js index 16238de6..d11f2584 100755 --- a/ui (gen4)/data.js +++ b/ui (gen4)/data.js @@ -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'){ diff --git a/ui (gen4)/viewer.js b/ui (gen4)/viewer.js index dc975dfe..ef1581b4 100755 --- a/ui (gen4)/viewer.js +++ b/ui (gen4)/viewer.js @@ -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 }],