diff --git a/ui (gen4)/features/base.js b/ui (gen4)/features/base.js index 33a80fba..59aac2dd 100755 --- a/ui (gen4)/features/base.js +++ b/ui (gen4)/features/base.js @@ -80,6 +80,7 @@ function(attr, states, callback){ /*********************************************************************/ // XXX split this into read and write actions... +// XXX check if align by position is relevant here... var BaseActions = module.BaseActions = actions.Actions({ @@ -98,12 +99,11 @@ actions.Actions({ // // XXX should this be here??? 'ribbon-focus-modes': [ - 'visual', // select image closest visually 'order', // select image closest to current in order 'first', // select first image 'last', // select last image ], - 'ribbon-focus-mode': 'visual', + 'ribbon-focus-mode': 'order', }, @@ -293,17 +293,9 @@ actions.Actions({ } else if(mode == 'first' || mode == 'last'){ var t = data.getImage(mode, r) - // visually closest image... - //} else if(mode == 'visual'){ + // unknown mode... } else { - var ribbons = this.ribbons - var t = ribbons.getImageByPosition('current', r) - - if(t.length > 1){ - t = t.eq(direction == 'before' ? 0 : 1) - } - - t = ribbons.getElemGID(t) + return } this.focusImage(t, r) diff --git a/ui (gen4)/features/ui.js b/ui (gen4)/features/ui.js index 7f3dc6e4..1e343171 100755 --- a/ui (gen4)/features/ui.js +++ b/ui (gen4)/features/ui.js @@ -144,6 +144,16 @@ actions.Actions({ 'dark', 'light', ], + + // XXX BUG: for some reason this get's shadowed by base.config... + 'ribbon-focus-modes': [ + 'visual', // select image closest visually + + 'order', // select image closest to current in order + 'first', // select first image + 'last', // select last image + ], + 'ribbon-focus-mode': 'visual', }, // Images... @@ -718,6 +728,33 @@ module.Viewer = core.ImageGridFeatures.Feature({ delete that.__viewer_resize } }], + + // add support for visual mode... + // XXX 'visual' mode fails in single-image-mode.... + ['focusRibbon', + function(res, target, mode){ + mode = mode || this.config['ribbon-focus-mode'] + + var c = this.data.getRibbonOrder() + var i = this.data.getRibbonOrder(r) + // NOTE: we are not changing the direction here based on + // this.direction as swap will confuse the user... + var direction = c < i ? 'before' : 'after' + + if(mode == 'visual'){ + var ribbons = this.ribbons + var r = this.data.getRibbon(target) + var t = ribbons.getImageByPosition('current', r) + + if(t.length > 1){ + t = t.eq(direction == 'before' ? 0 : 1) + } + + t = ribbons.getElemGID(t) + + this.focusImage(t, r) + } + }], ], }) diff --git a/ui (gen4)/lib/features.js b/ui (gen4)/lib/features.js index 00ca42e8..aa7f3ce4 100755 --- a/ui (gen4)/lib/features.js +++ b/ui (gen4)/lib/features.js @@ -110,10 +110,14 @@ module.FeatureProto = { actions.config = {} } Object.keys(config).forEach(function(n){ + /* // keep existing keys... if(actions.config[n] === undefined){ actions.config[n] = config[n] } + */ + // NOTE: this will overwrite existing values... + actions.config[n] = config[n] }) }