started work on .alignToRibbon(..), still a bit buggy...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2016-07-01 03:44:13 +03:00
parent 4d095ea351
commit 9cfab342e5
3 changed files with 17 additions and 4 deletions

View File

@ -584,6 +584,14 @@ actions.Actions({
function(target){ this.flip(target, 'vertical') }], function(target){ this.flip(target, 'vertical') }],
flipHorizontal: ['Image|Edit/Flip image horizontally', flipHorizontal: ['Image|Edit/Flip image horizontally',
function(target){ this.flip(target, 'horizontal') }], 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)
}],
}) })

View File

@ -841,6 +841,7 @@ module.ViewerActions = actions.Actions({
flipHorizontal: [ flipHorizontal: [
function(target){ this.ribbons.flipHorizontal(target, 'view') }], function(target){ this.ribbons.flipHorizontal(target, 'view') }],
alignToRibbon: [ reloadAfter(true) ],
// tags... // tags...
tag: [ tag: [

View File

@ -2045,7 +2045,11 @@ var DataPrototype = {
// NOTE: this will not affect the original data object... // NOTE: this will not affect the original data object...
// NOTE: this might result in empty ribbons, if no images are in a // NOTE: this might result in empty ribbons, if no images are in a
// given ribbon in the section to be split... // 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. // NOTE: if no target is given this will assume the current image.
// //
// XXX do .eachImageList(..) // XXX do .eachImageList(..)
@ -2062,8 +2066,8 @@ var DataPrototype = {
// NOTE: we modify tail here on each iteration... // NOTE: we modify tail here on each iteration...
target.forEach(function(i){ target.forEach(function(i){
i = i >= that.order.length i = i >= that.order.length ? tail.order.length
? tail.order.length : typeof(i) == typeof(123) ? tail.getImageOrder(that.getImage(i, 'global'))
: tail.getImageOrder(that.getImage(i)) : tail.getImageOrder(that.getImage(i))
var n = new Data() var n = new Data()
n.base = tail.base n.base = tail.base
@ -2230,7 +2234,7 @@ var DataPrototype = {
rest[0].setBase(0) rest[0].setBase(0)
// join the resulting data to the base ribbon... // join the resulting data to the base ribbon...
res = res.join(rest) res = res[0].join(rest)
// transfer data to new data object... // transfer data to new data object...
res.current = this.current res.current = this.current