mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-11-02 12:20:08 +00:00
now shifting image up/down resets the base ribbon if it gets removed...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
472e5c29ca
commit
e20f337978
@ -1233,15 +1233,16 @@ module.DataPrototype = {
|
|||||||
|
|
||||||
// Shorthand actions...
|
// Shorthand actions...
|
||||||
//
|
//
|
||||||
// NOTE: shiftImageUp/shiftImageDown will create new ribbons when
|
|
||||||
// shifting from first/last ribbons respectively.
|
|
||||||
// NOTE: shiftImageUp/shiftImageUp will remove an empty ribbon after
|
|
||||||
// shifting the last image out...
|
|
||||||
// NOTE: none of these change .current
|
// NOTE: none of these change .current
|
||||||
//
|
|
||||||
shiftImageLeft: function(gid){ return this.shiftImage(gid, -1, 'offset') },
|
shiftImageLeft: function(gid){ return this.shiftImage(gid, -1, 'offset') },
|
||||||
shiftImageRight: function(gid){ return this.shiftImage(gid, 1, 'offset') },
|
shiftImageRight: function(gid){ return this.shiftImage(gid, 1, 'offset') },
|
||||||
// XXX these can remove ribbons, do we need to shift base ribbon???
|
// NOTE: these will not affect ribbon order.
|
||||||
|
// NOTE: these will create new ribbons when shifting from first/last
|
||||||
|
// ribbons respectively.
|
||||||
|
// NOTE: these will remove an empty ribbon after shifting the last
|
||||||
|
// image out...
|
||||||
|
// NOTE: if base ribbon is removed this will try and reset it to the
|
||||||
|
// ribbon above or the top ribbon...
|
||||||
shiftImageUp: function(gid){
|
shiftImageUp: function(gid){
|
||||||
var g = gid.constructor === Array ? gid[0] : gid
|
var g = gid.constructor === Array ? gid[0] : gid
|
||||||
var r = this.getRibbonOrder(g)
|
var r = this.getRibbonOrder(g)
|
||||||
@ -1254,8 +1255,15 @@ module.DataPrototype = {
|
|||||||
// clear empty ribbon...
|
// clear empty ribbon...
|
||||||
r = r == 0 ? 1 : r
|
r = r == 0 ? 1 : r
|
||||||
if(this.ribbons[this.ribbon_order[r]].len() == 0){
|
if(this.ribbons[this.ribbon_order[r]].len() == 0){
|
||||||
|
var b = this.getRibbonOrder(this.base)-1
|
||||||
|
|
||||||
r = this.ribbon_order.splice(r, 1)[0]
|
r = this.ribbon_order.splice(r, 1)[0]
|
||||||
delete this.ribbons[r]
|
delete this.ribbons[r]
|
||||||
|
|
||||||
|
// shift base...
|
||||||
|
if(!(this.base in this.ribbons)){
|
||||||
|
this.setBase(Math.max(0, b))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
},
|
},
|
||||||
@ -1269,8 +1277,15 @@ module.DataPrototype = {
|
|||||||
var res = this.shiftImage(gid, r+1, 'vertical')
|
var res = this.shiftImage(gid, r+1, 'vertical')
|
||||||
// clear empty ribbon...
|
// clear empty ribbon...
|
||||||
if(this.ribbons[this.ribbon_order[r]].len() == 0){
|
if(this.ribbons[this.ribbon_order[r]].len() == 0){
|
||||||
|
var b = this.getRibbonOrder(this.base)-1
|
||||||
|
|
||||||
r = this.ribbon_order.splice(r, 1)[0]
|
r = this.ribbon_order.splice(r, 1)[0]
|
||||||
delete this.ribbons[r]
|
delete this.ribbons[r]
|
||||||
|
|
||||||
|
// shift base...
|
||||||
|
if(!(this.base in this.ribbons)){
|
||||||
|
this.setBase(Math.max(0, b))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
},
|
},
|
||||||
@ -1288,7 +1303,6 @@ module.DataPrototype = {
|
|||||||
// .shiftRibbon(gid, offset, 'offset')
|
// .shiftRibbon(gid, offset, 'offset')
|
||||||
// -> data
|
// -> data
|
||||||
//
|
//
|
||||||
//
|
|
||||||
// XXX test...
|
// XXX test...
|
||||||
shiftRibbon: function(gid, to, mode){
|
shiftRibbon: function(gid, to, mode){
|
||||||
var i = this.getRibbonOrder(gid)
|
var i = this.getRibbonOrder(gid)
|
||||||
|
|||||||
@ -36,7 +36,7 @@ module.mock_data = {
|
|||||||
varsion: '3.0',
|
varsion: '3.0',
|
||||||
|
|
||||||
current: 'b',
|
current: 'b',
|
||||||
base: 'x',
|
base: 'r0',
|
||||||
|
|
||||||
order: [],
|
order: [],
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user