added next/prev in order actions...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2014-10-19 22:32:33 +04:00
parent 5bd0d5bcb5
commit 177e871929
3 changed files with 64 additions and 40 deletions

View File

@ -373,8 +373,14 @@ module.RibbonsPrototype = {
// //
// NOTE: if a previous shadow if the same image exists this will recycle // NOTE: if a previous shadow if the same image exists this will recycle
// the existing shadow and cancel it's removal. // the existing shadow and cancel it's removal.
// ...this is useful for when a second consecutive action with
// the same image is issued before the previous has time to
// complete, recycling the shadow will enable a single flowing
// animation for such series of commands.
// Example: several fast consecutive horizontal shifts will result
// in a single shadow "flowing" through the ribbon.
// NOTE: multiple shadows of different images are supported...
// //
// XXX make this work for multiple targets...
// XXX should we also have a ribbon shadow??? // XXX should we also have a ribbon shadow???
makeShadow: function(target, animate, delay){ makeShadow: function(target, animate, delay){
delay = delay || 200 delay = delay || 200

View File

@ -128,6 +128,8 @@ module.GLOBAL_KEYBOARD = {
}, },
ctrl: function(){ a.nextScreen() }, ctrl: function(){ a.nextScreen() },
}, },
'(': function(){ a.prevImageInOrder() },
')': function(){ a.nextImageInOrder() },
Up: { Up: {
default: function(){ a.prevRibbon() }, default: function(){ a.prevRibbon() },
shift: function(){ a.shiftImageUp() }, shift: function(){ a.shiftImageUp() },

View File

@ -127,8 +127,8 @@ actions.Actions({
// basic navigation... // basic navigation...
// //
focusImage: ['Focus image', focusImage: ['Focus image',
function(img){ function(img, list){
this.data.focusImage(img) this.data.focusImage(img, list)
}], }],
focusRibbon: ['Focus Ribbon', focusRibbon: ['Focus Ribbon',
function(target){ function(target){
@ -152,7 +152,7 @@ actions.Actions({
this.focusImage(t, r) this.focusImage(t, r)
}], }],
setBaseRibbon: ['', setBaseRibbon: ['Set base ribbon',
function(target){ this.data.setBase(target) }], function(target){ this.data.setBase(target) }],
// shorthands for .focusImage(..) and .focusRibbon(..)... // shorthands for .focusImage(..) and .focusRibbon(..)...
@ -174,6 +174,19 @@ actions.Actions({
this.focusImage('next') this.focusImage('next')
}], }],
prevImageInOrder: ['Focus previous image in order',
function(){
// keep track of traverse direction...
this.direction = 'left'
this.focusImage('prev', this.data.order)
}],
nextImageInOrder: ['Focus next image in order',
function(){
// keep track of traverse direction...
this.direction = 'right'
this.focusImage('next', this.data.order)
}],
firstRibbon: ['Focus previous ribbon', firstRibbon: ['Focus previous ribbon',
function(){ this.focusRibbon('fisrt') }], function(){ this.focusRibbon('fisrt') }],
lastRibbon: ['Focus next ribbon', lastRibbon: ['Focus next ribbon',
@ -359,58 +372,61 @@ actions.Actions(Client, {
focusImage: [ focusImage: [
// XXX skip invisible ribbons (???) // XXX skip invisible ribbons (???)
// XXX load data chunks... // XXX load data chunks...
function(target){ function(target, list){
var ribbons = this.ribbons var ribbons = this.ribbons
var data = this.data var data = this.data
if(data != null){ if(data == null){
var gid = data.getImage(target)
gid = gid == null ? data.getImage('current') : gid
// XXX see if we need to load a new data set...
// XXX
target = ribbons.focusImage(gid)
} else {
target = ribbons.focusImage(target) target = ribbons.focusImage(target)
var gid = ribbons.getElemGID(target) var gid = ribbons.getElemGID(target)
} }
// align current ribbon... return function(){
ribbons if(data != null){
.centerRibbon(target) // use the data for all the heavy lifting...
.centerImage(target) // NOTE: this will prevent sync errors...
var gid = data.getImage()
target = ribbons.focusImage(gid)
// align other ribbons... // XXX see if we need to do some loading...
if(data != null){
var ribbon = data.getRibbon(gid)
for(var r in data.ribbons){
// skip the current ribbon...
if(r == ribbon){
continue
}
// XXX skip off-screen ribbons...
// XXX // XXX
}
// center... // align current ribbon...
// XXX is there a 'last' special case here??? ribbons
var t = data.getImage(gid, r) .centerRibbon(target)
if(t == null){ .centerImage(target)
var f = data.getImage('first', r)
// nothing found -- empty ribbon? // align other ribbons...
if(f == null){ if(data != null){
var ribbon = data.getRibbon(gid)
for(var r in data.ribbons){
// skip the current ribbon...
if(r == ribbon){
continue continue
} }
ribbons.centerImage(data.getImage('first', r), 'before')
} else { // XXX skip off-screen ribbons...
ribbons.centerImage(t, 'after') // XXX
// center...
// XXX is there a 'last' special case here???
var t = data.getImage(gid, r)
if(t == null){
var f = data.getImage('first', r)
// nothing found -- empty ribbon?
if(f == null){
continue
}
ribbons.centerImage(data.getImage('first', r), 'before')
} else {
ribbons.centerImage(t, 'after')
}
} }
} }
} }
}], }],
setBaseRibbon: ['', setBaseRibbon: [
function(target){ function(target){
var r = this.data.getRibbon(target) var r = this.data.getRibbon(target)
r = r == null ? this.ribbons.getRibbon(target) : r r = r == null ? this.ribbons.getRibbon(target) : r