fixed several .order_index related issues...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2018-12-24 00:52:54 +03:00
parent 85a4f3df0a
commit b6e12a804e

View File

@ -652,6 +652,7 @@ var DataPrototype = {
} }
}) })
}) })
delete this.__order_index
// clear empty ribbons only... // clear empty ribbons only...
} else if(gids == 'empty'){ } else if(gids == 'empty'){
@ -778,6 +779,9 @@ var DataPrototype = {
list[i] = to list[i] = to
} }
}) })
// XXX EXPERIMENTAL: order_index
delete this.order_index[from]
this.order_index[to] = i
} }
return this return this
}, },
@ -1677,6 +1681,10 @@ var DataPrototype = {
var r = this.getRibbon('current') var r = this.getRibbon('current')
// XXX EXPERIMENTAL: order_index
// XXX should this be optional???
delete this.__order_index
this.eachImageList(function(cur, key, set){ this.eachImageList(function(cur, key, set){
set = this[set] set = this[set]
@ -1723,6 +1731,8 @@ var DataPrototype = {
reverseImages: function(){ reverseImages: function(){
var order = this.order var order = this.order
order.reverse() order.reverse()
// XXX EXPERIMENTAL: order_index
delete this.__order_index
var l = order.length var l = order.length
var that = this var that = this
@ -1855,7 +1865,8 @@ var DataPrototype = {
// NOTE: we are moving left to right, thus the final order // NOTE: we are moving left to right, thus the final order
// of images will stay the same. // of images will stay the same.
if(f < ri){ if(f < ri){
order.splice(mode == 'after' ? l : ri-1, 0, order.splice(f, 1)[0]) var i = mode == 'after' ? l : ri-1
order.splice(i, 0, order.splice(f, 1)[0])
// target is right of the reference -- place each new image // target is right of the reference -- place each new image
// at an offset from reference, the offset is equal to // at an offset from reference, the offset is equal to
@ -1872,9 +1883,6 @@ var DataPrototype = {
} }
}) })
// update the order data...
this.order.splice.apply(this.order, [0, this.order.length].concat(order))
this.updateImagePositions() this.updateImagePositions()
} }