mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 10:20:08 +00:00
added next/prev in order actions...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
5bd0d5bcb5
commit
177e871929
@ -373,8 +373,14 @@ module.RibbonsPrototype = {
|
||||
//
|
||||
// NOTE: if a previous shadow if the same image exists this will recycle
|
||||
// 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???
|
||||
makeShadow: function(target, animate, delay){
|
||||
delay = delay || 200
|
||||
|
||||
@ -128,6 +128,8 @@ module.GLOBAL_KEYBOARD = {
|
||||
},
|
||||
ctrl: function(){ a.nextScreen() },
|
||||
},
|
||||
'(': function(){ a.prevImageInOrder() },
|
||||
')': function(){ a.nextImageInOrder() },
|
||||
Up: {
|
||||
default: function(){ a.prevRibbon() },
|
||||
shift: function(){ a.shiftImageUp() },
|
||||
|
||||
@ -127,8 +127,8 @@ actions.Actions({
|
||||
// basic navigation...
|
||||
//
|
||||
focusImage: ['Focus image',
|
||||
function(img){
|
||||
this.data.focusImage(img)
|
||||
function(img, list){
|
||||
this.data.focusImage(img, list)
|
||||
}],
|
||||
focusRibbon: ['Focus Ribbon',
|
||||
function(target){
|
||||
@ -152,7 +152,7 @@ actions.Actions({
|
||||
|
||||
this.focusImage(t, r)
|
||||
}],
|
||||
setBaseRibbon: ['',
|
||||
setBaseRibbon: ['Set base ribbon',
|
||||
function(target){ this.data.setBase(target) }],
|
||||
|
||||
// shorthands for .focusImage(..) and .focusRibbon(..)...
|
||||
@ -174,6 +174,19 @@ actions.Actions({
|
||||
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',
|
||||
function(){ this.focusRibbon('fisrt') }],
|
||||
lastRibbon: ['Focus next ribbon',
|
||||
@ -359,58 +372,61 @@ actions.Actions(Client, {
|
||||
focusImage: [
|
||||
// XXX skip invisible ribbons (???)
|
||||
// XXX load data chunks...
|
||||
function(target){
|
||||
function(target, list){
|
||||
var ribbons = this.ribbons
|
||||
var data = this.data
|
||||
|
||||
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 {
|
||||
if(data == null){
|
||||
target = ribbons.focusImage(target)
|
||||
var gid = ribbons.getElemGID(target)
|
||||
}
|
||||
|
||||
// align current ribbon...
|
||||
ribbons
|
||||
.centerRibbon(target)
|
||||
.centerImage(target)
|
||||
return function(){
|
||||
if(data != null){
|
||||
// use the data for all the heavy lifting...
|
||||
// NOTE: this will prevent sync errors...
|
||||
var gid = data.getImage()
|
||||
target = ribbons.focusImage(gid)
|
||||
|
||||
// align other ribbons...
|
||||
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 see if we need to do some loading...
|
||||
// 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){
|
||||
// align current ribbon...
|
||||
ribbons
|
||||
.centerRibbon(target)
|
||||
.centerImage(target)
|
||||
|
||||
// align other ribbons...
|
||||
if(data != null){
|
||||
var ribbon = data.getRibbon(gid)
|
||||
for(var r in data.ribbons){
|
||||
// skip the current ribbon...
|
||||
if(r == ribbon){
|
||||
continue
|
||||
}
|
||||
ribbons.centerImage(data.getImage('first', r), 'before')
|
||||
} else {
|
||||
ribbons.centerImage(t, 'after')
|
||||
|
||||
// XXX skip off-screen ribbons...
|
||||
// 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){
|
||||
var r = this.data.getRibbon(target)
|
||||
r = r == null ? this.ribbons.getRibbon(target) : r
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user