From 1c507a891576fe6f0b8219405766e519bf118f57 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sun, 4 Nov 2018 15:08:30 +0300 Subject: [PATCH] fixed a bug + doc revision... Signed-off-by: Alex A. Naanou --- ui (gen4)/features/base.js | 3 ++- ui (gen4)/imagegrid/data.js | 33 +++++++++++++++++++++------------ 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/ui (gen4)/features/base.js b/ui (gen4)/features/base.js index b5798037..16ee169c 100755 --- a/ui (gen4)/features/base.js +++ b/ui (gen4)/features/base.js @@ -473,7 +473,8 @@ actions.Actions({ has a slightly different signature to the above, this is done for simplicity... `, - function(img, list){ this.data.focusImage.apply(this.data, arguments) }], + //function(img, list){ this.data.focusImage.apply(this.data, arguments) }], + function(img, list){ this.data.focusImage(...arguments) }], // Focuses a ribbon by selecting an image in it... // // modes supported: diff --git a/ui (gen4)/imagegrid/data.js b/ui (gen4)/imagegrid/data.js index 256ea3ce..7a6e1500 100755 --- a/ui (gen4)/imagegrid/data.js +++ b/ui (gen4)/imagegrid/data.js @@ -760,16 +760,11 @@ var DataPrototype = { // NOTE: the second argument must be .getRibbon(..) compatible. // NOTE: to get global first/last image use the index, e.g.: // .getImage(0) / .getImage(-1) - // - // Get image closest to current in list/ribbon: - // .getImage(list|ribbon[, 'before'|'after']) - // -> gid - // -> null - // NOTE: null is returned if there is no image before/after the - // current image in the given list/ribbon, e.g. the - // current image is first/last resp. - // NOTE: 'before' is default. - // NOTE: the first argument must not be a number. + // NOTE: to reference relative ribbon 'before'/'after' keywords + // are ignored, use 'above'/'prev' or 'below'/'next' instead. + // This is done foe uniformity with: + // .getImage(gid|order, 'before'|'after', ...) + // ...see below for more info. // // Get image closest to current or a specific image: // .getImage('before'[, list|ribbon]) @@ -786,6 +781,17 @@ var DataPrototype = { // NOTE: in both the above cases if gid|order is found explicitly // it will be returned. // + // Get image closest to current in list/ribbon (special case): + // .getImage(list|ribbon[, 'before'|'after']) + // -> gid + // -> null + // NOTE: null is returned if there is no image before/after the + // current image in the given list/ribbon, e.g. the + // current image is first/last resp. + // NOTE: 'before' is default. + // NOTE: the first argument must not be a number. + // + // // Get next/prev image (offset of 1): // .getImage('next') // .getImage('prev') @@ -818,6 +824,7 @@ var DataPrototype = { // // XXX most of the complexity here comes from argument DSL parsing, // might be good to revise argument syntax and handling... + // XXX doc needs revision.... getImage: function(target, mode, list){ // empty data... if(this.order == null || (this.order && this.order.length == 0)){ @@ -842,6 +849,7 @@ var DataPrototype = { // first/last special case... // XXX need to get first loaded... if(target == 'first'){ + mode = mode == 'before' || mode == 'after' ? null : mode list = this.ribbons[this.getRibbon(mode)] for(var res in list){ return list[res] @@ -849,6 +857,7 @@ var DataPrototype = { return null } if(target == 'last'){ + mode = mode == 'before' || mode == 'after' ? null : mode list = this.ribbons[this.getRibbon(mode)] for(var i=list.length; i >= 0; i--){ if(list[i] != null){ @@ -1341,8 +1350,8 @@ var DataPrototype = { return this.ribbon_order.slice(-1)[0] } - target = target == 'next' ? 'after' : target - target = target == 'prev' ? 'before' : target + target = target == 'next' || target == 'below' ? 'after' : target + target = target == 'prev' || target == 'above' ? 'before' : target if(target == 'before' || target == 'after'){ offset = target