mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 18:30:09 +00:00
testing and cleanup of .focusImage(..) and friends...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
0ce58772ee
commit
f80ed5ad45
26
ui/data4.js
26
ui/data4.js
@ -200,7 +200,6 @@ var DataPrototype = {
|
|||||||
return lst
|
return lst
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
// Generate a uniqie GID...
|
// Generate a uniqie GID...
|
||||||
//
|
//
|
||||||
// XXX generate a real gid...
|
// XXX generate a real gid...
|
||||||
@ -629,16 +628,6 @@ var DataPrototype = {
|
|||||||
//
|
//
|
||||||
// This is signature compatible with .getImage(..), see it for more
|
// This is signature compatible with .getImage(..), see it for more
|
||||||
// info...
|
// info...
|
||||||
//
|
|
||||||
// XXX do we need more specific focus operations like:
|
|
||||||
// .focusImageOffset(offset)
|
|
||||||
// XXX reference impelementation:
|
|
||||||
// return this.focusImage('current', offset)
|
|
||||||
// .focusRibbonOffset(offset)
|
|
||||||
// XXX reference impelementation:
|
|
||||||
// var c = this.getRibbonOrder()
|
|
||||||
// var t = c+offset
|
|
||||||
// return this.focusImage('current', (t < c ? 'after' : 'before'), t)
|
|
||||||
focusImage: function(target, mode, list){
|
focusImage: function(target, mode, list){
|
||||||
var current = this.getImage(target, mode, list)
|
var current = this.getImage(target, mode, list)
|
||||||
if(this.order.indexOf(current) >= 0){
|
if(this.order.indexOf(current) >= 0){
|
||||||
@ -649,8 +638,18 @@ var DataPrototype = {
|
|||||||
|
|
||||||
// Shorthand methods...
|
// Shorthand methods...
|
||||||
//
|
//
|
||||||
|
// XXX firstImage/lastImage???
|
||||||
|
// XXX focusBaseRibbon?
|
||||||
|
// XXX test vertical...
|
||||||
// XXX should these be here???
|
// XXX should these be here???
|
||||||
focusImageOffset: function(offset){
|
focusImageOffset: function(offset){
|
||||||
|
offset = offset == null ? 0 : offset
|
||||||
|
|
||||||
|
var min = -this.getImageOrder('ribbon')
|
||||||
|
var max = this.getImages('current').length-1
|
||||||
|
|
||||||
|
offset = Math.max(min, Math.min(max, offset))
|
||||||
|
|
||||||
return this.focusImage('current', offset)
|
return this.focusImage('current', offset)
|
||||||
},
|
},
|
||||||
nextImage: function(){ return this.focusImageOffset(1) },
|
nextImage: function(){ return this.focusImageOffset(1) },
|
||||||
@ -659,6 +658,9 @@ var DataPrototype = {
|
|||||||
var c = this.getRibbonOrder()
|
var c = this.getRibbonOrder()
|
||||||
var t = c+offset
|
var t = c+offset
|
||||||
t = Math.max(0, Math.min(this.ribbon_order.length-1, t))
|
t = Math.max(0, Math.min(this.ribbon_order.length-1, t))
|
||||||
|
|
||||||
|
// NOTE: the modes here are different for directions to balance
|
||||||
|
// up/down navigation...
|
||||||
return this.focusImage('current', (t < c ? 'after' : 'before'), t)
|
return this.focusImage('current', (t < c ? 'after' : 'before'), t)
|
||||||
},
|
},
|
||||||
nextRibbon: function(){ return this.focusRibbonOffset(1) },
|
nextRibbon: function(){ return this.focusRibbonOffset(1) },
|
||||||
@ -805,7 +807,7 @@ var DataPrototype = {
|
|||||||
|
|
||||||
// normalize the target...
|
// normalize the target...
|
||||||
// XXX is this the correct way to go???
|
// XXX is this the correct way to go???
|
||||||
target = Math.max(0, Math.min(this.ribbon_order.length-1, target)
|
target = Math.max(0, Math.min(this.ribbon_order.length-1, target))
|
||||||
|
|
||||||
var ribbon = this.ribbon_order[target]
|
var ribbon = this.ribbon_order[target]
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user