mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-12-17 08:41:40 +00:00
did shift ribbon actions + minor tweaks + some refactoring...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
9487270e73
commit
29c9fa8ed5
@ -588,12 +588,20 @@ module.RibbonsPrototype = {
|
|||||||
// XXX what do we do if the target does not exist, i.e. p == -1 ????
|
// XXX what do we do if the target does not exist, i.e. p == -1 ????
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(i == position){
|
||||||
|
return ribbon
|
||||||
|
}
|
||||||
|
|
||||||
// place the ribbon...
|
// place the ribbon...
|
||||||
if(ribbons.length == 0 || ribbons.length <= position){
|
if(ribbons.length == 0 || ribbons.length <= position){
|
||||||
this.viewer.find('.ribbon-set').append(ribbon)
|
this.viewer.find('.ribbon-set').append(ribbon)
|
||||||
|
|
||||||
} else if(i != position) {
|
} else if(i > position) {
|
||||||
ribbons.eq(position).before(ribbon)
|
ribbons.eq(position).before(ribbon)
|
||||||
|
|
||||||
|
// for placing after need to account for target ribbon removal...
|
||||||
|
} else if(i < position) {
|
||||||
|
ribbons.eq(position).after(ribbon)
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX do we need to update the ribbon here???
|
// XXX do we need to update the ribbon here???
|
||||||
|
|||||||
@ -118,6 +118,7 @@ module.GLOBAL_KEYBOARD = {
|
|||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
a.shiftImageLeft()
|
a.shiftImageLeft()
|
||||||
},
|
},
|
||||||
|
ctrl: function(){ a.prevScreen() },
|
||||||
},
|
},
|
||||||
Right: {
|
Right: {
|
||||||
default: function(){ a.nextImage() },
|
default: function(){ a.nextImage() },
|
||||||
@ -125,6 +126,7 @@ module.GLOBAL_KEYBOARD = {
|
|||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
a.shiftImageRight()
|
a.shiftImageRight()
|
||||||
},
|
},
|
||||||
|
ctrl: function(){ a.nextScreen() },
|
||||||
},
|
},
|
||||||
Up: {
|
Up: {
|
||||||
default: function(){ a.prevRibbon() },
|
default: function(){ a.prevRibbon() },
|
||||||
|
|||||||
@ -292,16 +292,17 @@ actions.Actions({
|
|||||||
this.focusImage()
|
this.focusImage()
|
||||||
}],
|
}],
|
||||||
|
|
||||||
// XXX
|
|
||||||
sortImages: [
|
|
||||||
function(){ }],
|
|
||||||
reverseImages: [
|
reverseImages: [
|
||||||
function(){ this.data.reverseImages() }],
|
function(){ this.data.reverseImages() }],
|
||||||
|
|
||||||
|
// XXX this also requires images...
|
||||||
|
sortImages: [
|
||||||
|
function(){ }],
|
||||||
|
|
||||||
// basic image editing...
|
// basic image editing...
|
||||||
//
|
//
|
||||||
// XXX
|
// XXX these are not data stuff... should this be split into a
|
||||||
|
// separate images block???
|
||||||
rotateCW: [
|
rotateCW: [
|
||||||
function(){ }],
|
function(){ }],
|
||||||
rotateCCW: [
|
rotateCCW: [
|
||||||
@ -422,17 +423,19 @@ actions.Actions(Client, {
|
|||||||
this.ribbons.setBaseRibbon(r)
|
this.ribbons.setBaseRibbon(r)
|
||||||
}],
|
}],
|
||||||
|
|
||||||
// XXX test...
|
|
||||||
prevScreen: ['Focus previous image one screen width away',
|
prevScreen: ['Focus previous image one screen width away',
|
||||||
function(){
|
function(){
|
||||||
var s = Math.floor(this.ribbons.getScreenWidthImages())
|
var s = Math.ceil(this.ribbons.getScreenWidthImages())
|
||||||
this.focusImage(this.data.getImage('current', -s))
|
this.focusImage(this.data.getImage('current', -s)
|
||||||
|
// go to the first image if it's closer than s...
|
||||||
|
|| this.data.getImage('first'))
|
||||||
}],
|
}],
|
||||||
// XXX test...
|
|
||||||
nextScreen: ['Focus next image one screen width away',
|
nextScreen: ['Focus next image one screen width away',
|
||||||
function(){
|
function(){
|
||||||
var s = Math.floor(this.ribbons.getScreenWidthImages())
|
var s = Math.ceil(this.ribbons.getScreenWidthImages())
|
||||||
this.focusImage(this.data.getImage('current', s))
|
this.focusImage(this.data.getImage('current', s)
|
||||||
|
// go to the last image if it's closer than s...
|
||||||
|
|| this.data.getImage('last'))
|
||||||
}],
|
}],
|
||||||
|
|
||||||
// zooming...
|
// zooming...
|
||||||
@ -523,11 +526,19 @@ actions.Actions(Client, {
|
|||||||
|
|
||||||
shiftRibbonUp: [
|
shiftRibbonUp: [
|
||||||
function(target){
|
function(target){
|
||||||
// XXX
|
target = this.ribbons.getRibbon(target)
|
||||||
|
var i = this.ribbons.getRibbonOrder(target)
|
||||||
|
if(i > 0){
|
||||||
|
this.ribbons.placeRibbon(target, i-1)
|
||||||
|
}
|
||||||
}],
|
}],
|
||||||
shiftRibbonDown: [
|
shiftRibbonDown: [
|
||||||
function(target){
|
function(target){
|
||||||
// XXX
|
target = this.ribbons.getRibbon(target)
|
||||||
|
var i = this.ribbons.getRibbonOrder(target)
|
||||||
|
if(i < this.data.ribbon_order.length-1){
|
||||||
|
this.ribbons.placeRibbon(target, i+1)
|
||||||
|
}
|
||||||
}],
|
}],
|
||||||
|
|
||||||
reverseImages: [
|
reverseImages: [
|
||||||
@ -542,15 +553,14 @@ actions.Actions(Client, {
|
|||||||
|
|
||||||
// basic image editing...
|
// basic image editing...
|
||||||
//
|
//
|
||||||
// XXX
|
|
||||||
rotateCW: [
|
rotateCW: [
|
||||||
function(){ }],
|
function(target){ this.ribbons.rotateCW(target) }],
|
||||||
rotateCCW: [
|
rotateCCW: [
|
||||||
function(){ }],
|
function(target){ this.ribbons.rotateCCW(target) }],
|
||||||
flipVertical: [
|
flipVertical: [
|
||||||
function(){ }],
|
function(target){ this.ribbons.flipVertical(target) }],
|
||||||
flipHorizontal: [
|
flipHorizontal: [
|
||||||
function(){ }],
|
function(target){ this.ribbons.flipHorizontal(target) }],
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user