diff --git a/ui (gen4)/lib/actions.js b/ui (gen4)/lib/actions.js index 577f4f7d..13b9369e 100755 --- a/ui (gen4)/lib/actions.js +++ b/ui (gen4)/lib/actions.js @@ -530,7 +530,11 @@ module.MetaActions = { // otherwise only mixin local actions... // // XXX test - mixin: function(from, all, all_attr_types){ + mixin: function(from, all, descriptors, all_attr_types){ + // defaults... + descriptors = descriptors || true + all_attr_types = all_attr_types || false + if(all){ var keys = [] for(var k in from){ @@ -542,9 +546,19 @@ module.MetaActions = { var that = this keys.forEach(function(k){ - var attr = from[k] - if(all_attr_types || attr instanceof Action){ - that[k] = attr + // properties.... + var prop = Object.getOwnPropertyDescriptor(from, k) + if(descriptors && prop.get != null){ + // NOTE: so as to be able to delete this on mixout... + prop.configurable = true + Object.defineProperty(that, k, prop) + + // actions and other attributes... + } else { + var attr = from[k] + if(all_attr_types || attr instanceof Action){ + that[k] = attr + } } }) @@ -569,6 +583,10 @@ module.MetaActions = { // XXX not sure about these... // XXX test mixout: function(from, all, all_attr_types){ + // defaults... + descriptors = descriptors || true + all_attr_types = all_attr_types || false + if(all){ var keys = [] for(var k in from){ @@ -581,11 +599,22 @@ module.MetaActions = { var locals = Object.keys(this) var that = this keys.forEach(function(k){ - var attr = from[k] - if((all_attr_types || attr instanceof Action) - // remove only local attrs... - && locals.indexOf(k) >= 0){ - delete that[k] + var prop = Object.getOwnPropertyDescriptor(from, k) + + // descriptor... + if(descriptors && prop.get != null){ + if(prop.get === Object.getOwnPropertyDescriptor(that, k).get){ + delete that[k] + } + + // actions and other attrs... + } else { + var attr = from[k] + if((all_attr_types || attr instanceof Action) + // remove only local attrs... + && locals.indexOf(k) >= 0){ + delete that[k] + } } }) diff --git a/ui (gen4)/ui.js b/ui (gen4)/ui.js index bc41b25f..b9a9c01c 100755 --- a/ui (gen4)/ui.js +++ b/ui (gen4)/ui.js @@ -183,7 +183,7 @@ module.GLOBAL_KEYBOARD = { B: { default: 'toggleBookmark', - ctrl: 'toggleTheme', + ctrl: 'toggleTheme!', }, }, } diff --git a/ui (gen4)/viewer.js b/ui (gen4)/viewer.js index 40359f39..88f9d20c 100755 --- a/ui (gen4)/viewer.js +++ b/ui (gen4)/viewer.js @@ -1163,9 +1163,10 @@ var PartialRibbonsActions = actions.Actions({ var pl = this.ribbons.getImage(target).prevAll('.image:not(.clone)').length // next/prev available... - var na = this.data.getImages(target, size/2, 'after').length - 1 - var pa = this.data.getImages(target, size/2, 'before').length - 1 - + // NOTE: we subtract 1 to remove the current and make these + // compatible with: nl, pl + var na = this.data.getImages(target, size, 'after').length - 1 + var pa = this.data.getImages(target, size, 'before').length - 1 // do the update... // loaded more than we need (crop?)... @@ -1767,6 +1768,8 @@ module.GlobalStateIndicator = Feature({ //--------------------------------------------------------------------- +// XXX should we rename this to "select"??? + // target can be: // 'all' // 'loaded' @@ -1807,8 +1810,33 @@ function makeTagTogglerAction(tag){ // XXX add image updater... var ImageMarkActions = actions.Actions({ + + // NOTE: this will return a copy... + get marked(){ + if(this.data == null + || this.data.tags == null + || !('selected' in this.data.tags)){ + return [] + } + return this.data.tags['selected'].slice() + }, + + // Common use-cases: + // Toggle mark on current image + // .toggleMark() + // + // Mark current ribbon + // .toggleMark('ribbon', 'on') + // + // Unmark all loaded images + // .toggleMark('loaded', 'off') + // + // Invert marks on current ribbon + // .toggleMark('ribbon') + // toggleMark: ['Toggle image mark', makeTagTogglerAction('selected')], + // XXX toggleMarkBlock: ['Toggle block marks', 'A block is a set of adjacent images either marked on unmarked ' +'in the same way', @@ -1848,12 +1876,27 @@ module.ImageMarks = Feature({ tag: 'image-marks', actions: ImageMarkActions, + + // XXX image update... + handlers: [ + ], }) //--------------------------------------------------------------------- var ImageBookmarkActions = actions.Actions({ + + // NOTE: this will return a copy... + get bookmarked(){ + if(this.data == null + || this.data.tags == null + || !('bookmark' in this.data.tags)){ + return [] + } + return this.data.tags['bookmark'].slice() + }, + toggleBookmark: ['', makeTagTogglerAction('bookmark')], // action can be: