diff --git a/ui (gen4)/ribbons.js b/ui (gen4)/ribbons.js index 4a3b4af5..79c49b0d 100755 --- a/ui (gen4)/ribbons.js +++ b/ui (gen4)/ribbons.js @@ -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??? diff --git a/ui (gen4)/ui.js b/ui (gen4)/ui.js index 63abe0d6..66ca76cc 100755 --- a/ui (gen4)/ui.js +++ b/ui (gen4)/ui.js @@ -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() }, diff --git a/ui (gen4)/viewer.js b/ui (gen4)/viewer.js index 73395daa..56914be2 100755 --- a/ui (gen4)/viewer.js +++ b/ui (gen4)/viewer.js @@ -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) }], })