did shift ribbon actions + minor tweaks + some refactoring...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2014-10-18 04:26:52 +04:00
parent 9487270e73
commit 29c9fa8ed5
3 changed files with 38 additions and 18 deletions

View File

@ -588,12 +588,20 @@ module.RibbonsPrototype = {
// XXX what do we do if the target does not exist, i.e. p == -1 ????
}
if(i == position){
return ribbon
}
// place the ribbon...
if(ribbons.length == 0 || ribbons.length <= position){
this.viewer.find('.ribbon-set').append(ribbon)
} else if(i != position) {
} else if(i > position) {
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???

View File

@ -118,6 +118,7 @@ module.GLOBAL_KEYBOARD = {
event.preventDefault()
a.shiftImageLeft()
},
ctrl: function(){ a.prevScreen() },
},
Right: {
default: function(){ a.nextImage() },
@ -125,6 +126,7 @@ module.GLOBAL_KEYBOARD = {
event.preventDefault()
a.shiftImageRight()
},
ctrl: function(){ a.nextScreen() },
},
Up: {
default: function(){ a.prevRibbon() },

View File

@ -292,16 +292,17 @@ actions.Actions({
this.focusImage()
}],
// XXX
sortImages: [
function(){ }],
reverseImages: [
function(){ this.data.reverseImages() }],
// XXX this also requires images...
sortImages: [
function(){ }],
// basic image editing...
//
// XXX
// XXX these are not data stuff... should this be split into a
// separate images block???
rotateCW: [
function(){ }],
rotateCCW: [
@ -422,17 +423,19 @@ actions.Actions(Client, {
this.ribbons.setBaseRibbon(r)
}],
// XXX test...
prevScreen: ['Focus previous image one screen width away',
function(){
var s = Math.floor(this.ribbons.getScreenWidthImages())
this.focusImage(this.data.getImage('current', -s))
var s = Math.ceil(this.ribbons.getScreenWidthImages())
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',
function(){
var s = Math.floor(this.ribbons.getScreenWidthImages())
this.focusImage(this.data.getImage('current', s))
var s = Math.ceil(this.ribbons.getScreenWidthImages())
this.focusImage(this.data.getImage('current', s)
// go to the last image if it's closer than s...
|| this.data.getImage('last'))
}],
// zooming...
@ -523,11 +526,19 @@ actions.Actions(Client, {
shiftRibbonUp: [
function(target){
// XXX
target = this.ribbons.getRibbon(target)
var i = this.ribbons.getRibbonOrder(target)
if(i > 0){
this.ribbons.placeRibbon(target, i-1)
}
}],
shiftRibbonDown: [
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: [
@ -542,15 +553,14 @@ actions.Actions(Client, {
// basic image editing...
//
// XXX
rotateCW: [
function(){ }],
function(target){ this.ribbons.rotateCW(target) }],
rotateCCW: [
function(){ }],
function(target){ this.ribbons.rotateCCW(target) }],
flipVertical: [
function(){ }],
function(target){ this.ribbons.flipVertical(target) }],
flipHorizontal: [
function(){ }],
function(target){ this.ribbons.flipHorizontal(target) }],
})