diff --git a/ui/data.js b/ui/data.js index fb06f9a8..12c2fd9e 100755 --- a/ui/data.js +++ b/ui/data.js @@ -2275,6 +2275,7 @@ function setupData(viewer){ .on([ // ribbons.js API... 'shiftedImage', + 'shiftedImages', 'createdRibbon', 'removedRibbon', ].join(' '), function(){ diff --git a/ui/data4.js b/ui/data4.js index 9ed175f6..dee3676c 100755 --- a/ui/data4.js +++ b/ui/data4.js @@ -286,6 +286,7 @@ var DataPrototype = { // -> gid // -> null // NOTE: null is returned if there is no image at given offset. + // NOTE: offset is calculated within the same ribbon... // // // NOTE: If gid|order is not given, current image is assumed. @@ -366,11 +367,11 @@ var DataPrototype = { mode = offset < 0 ? 'before' : offset > 0 ? 'after' : mode + offset = Math.abs(offset) } else { var offset = 0 mode = mode == null ? 'before' : mode } - offset = Math.abs(offset) var i = this.order.indexOf(target) @@ -814,7 +815,7 @@ var DataPrototype = { // // order is expected to be ribbon order. // - // from must be: + // from must be one of: // - a .getImage(..) compatible object. usually an image gid, order, // or null, see .getImage(..) for more info. // - a list of .getImage(..) compatible objects. @@ -835,7 +836,6 @@ var DataPrototype = { // XXX when shifting groups of images we are using the first as a // base, should we use last as a base for right shifting??? // ...another way to go could be using current as a reference - // XXX process from as a list of gids... // XXX test vertical.. shiftImage: function(from, target, mode){ from = from == null ? this.current : from @@ -850,7 +850,6 @@ var DataPrototype = { // target is an offset... if(mode == 'offset'){ - // XXX change check this... // XXX check that we can place an elem at first and last positions... var t = this.getImageOrder(this.getImage(first, target)) @@ -922,7 +921,7 @@ var DataPrototype = { // shifting from first/last ribbons respectively. // NOTE: none of these change .current // - // XXX should this be here?? + // XXX should these be here?? shiftImageLeft: function(gid){ return this.shiftImage(gid, -1, 'offset') }, shiftImageRight: function(gid){ return this.shiftImage(gid, 1, 'offset') }, // XXX test... @@ -984,6 +983,7 @@ var DataPrototype = { // Shorthand actions... // + // XXX should these be here?? shiftRibbonUp: function(gid){ return this.shiftRibbon(gid, -1, 'offset') }, shiftRibbonDown: function(gid){ return this.shiftRibbon(gid, 1, 'offset') }, diff --git a/ui/marks.js b/ui/marks.js index 6b9c112d..3fabf8b6 100755 --- a/ui/marks.js +++ b/ui/marks.js @@ -602,6 +602,8 @@ function shiftMarkedImages(direction, mode, new_ribbon){ DATA.ribbons[cur] = fastSortGIDsByOrder(DATA.ribbons[cur].concat(marked)) } + dataUpdated() + // remove empty ribbons and reload... dropEmptyRibbons() reloadViewer()