From 9cfab342e56d390cd52a42c08e52ecd6ef8dc01e Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Fri, 1 Jul 2016 03:44:13 +0300 Subject: [PATCH] started work on .alignToRibbon(..), still a bit buggy... Signed-off-by: Alex A. Naanou --- ui (gen4)/features/base.js | 8 ++++++++ ui (gen4)/features/ui.js | 1 + ui (gen4)/imagegrid/data.js | 12 ++++++++---- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/ui (gen4)/features/base.js b/ui (gen4)/features/base.js index 10cdaa87..a879cd12 100755 --- a/ui (gen4)/features/base.js +++ b/ui (gen4)/features/base.js @@ -584,6 +584,14 @@ actions.Actions({ function(target){ this.flip(target, 'vertical') }], flipHorizontal: ['Image|Edit/Flip image horizontally', function(target){ this.flip(target, 'horizontal') }], + + + // complex operations... + // XXX align to ribbon... + alignToRibbon: ['Edit/', + function(target, start, end){ + this.data = this.data.alignToRibbon(target, start, end) + }], }) diff --git a/ui (gen4)/features/ui.js b/ui (gen4)/features/ui.js index 0b9a85b3..bc40a622 100755 --- a/ui (gen4)/features/ui.js +++ b/ui (gen4)/features/ui.js @@ -841,6 +841,7 @@ module.ViewerActions = actions.Actions({ flipHorizontal: [ function(target){ this.ribbons.flipHorizontal(target, 'view') }], + alignToRibbon: [ reloadAfter(true) ], // tags... tag: [ diff --git a/ui (gen4)/imagegrid/data.js b/ui (gen4)/imagegrid/data.js index 2c9cf434..dbf28b71 100755 --- a/ui (gen4)/imagegrid/data.js +++ b/ui (gen4)/imagegrid/data.js @@ -2045,7 +2045,11 @@ var DataPrototype = { // NOTE: this will not affect the original data object... // NOTE: this might result in empty ribbons, if no images are in a // given ribbon in the section to be split... - // NOTE: target must be a .getImage(..) compatible value. + // NOTE: target must be a .getImage(..) compatible value, for + // differences see next note. + // NOTE: if target is a number then it is treated as global index, + // similar to .getImageOrder(..) default but different form + // .getImage(..) // NOTE: if no target is given this will assume the current image. // // XXX do .eachImageList(..) @@ -2062,8 +2066,8 @@ var DataPrototype = { // NOTE: we modify tail here on each iteration... target.forEach(function(i){ - i = i >= that.order.length - ? tail.order.length + i = i >= that.order.length ? tail.order.length + : typeof(i) == typeof(123) ? tail.getImageOrder(that.getImage(i, 'global')) : tail.getImageOrder(that.getImage(i)) var n = new Data() n.base = tail.base @@ -2230,7 +2234,7 @@ var DataPrototype = { rest[0].setBase(0) // join the resulting data to the base ribbon... - res = res.join(rest) + res = res[0].join(rest) // transfer data to new data object... res.current = this.current