mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-28 18:00:09 +00:00
added current.js and a minor change to .getRibbon(...)...
This commit is contained in:
parent
4b35ba2e5e
commit
565f712e60
0
buildcache.py
Normal file → Executable file
0
buildcache.py
Normal file → Executable file
58
ui (gen4)/client.js
Executable file
58
ui (gen4)/client.js
Executable file
@ -0,0 +1,58 @@
|
|||||||
|
/**********************************************************************
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
**********************************************************************/
|
||||||
|
|
||||||
|
//var DEBUG = DEBUG != null ? DEBUG : true
|
||||||
|
|
||||||
|
define(function(require){ var module = {}
|
||||||
|
console.log('>>> ui')
|
||||||
|
|
||||||
|
doc = require('keyboard').doc
|
||||||
|
|
||||||
|
data = require('data')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*********************************************************************/
|
||||||
|
|
||||||
|
var CLIENT_ACTIONS = {
|
||||||
|
// this expects the folowing attrs:
|
||||||
|
//
|
||||||
|
// .data
|
||||||
|
//
|
||||||
|
|
||||||
|
focusImage: doc('Focus Image',
|
||||||
|
// XXX do we need to account for event first argument here???
|
||||||
|
function(gid){
|
||||||
|
this.data.focusImage(gid)
|
||||||
|
return this
|
||||||
|
}),
|
||||||
|
|
||||||
|
// target can be:
|
||||||
|
// - current
|
||||||
|
// - base
|
||||||
|
// - before
|
||||||
|
// - after
|
||||||
|
//
|
||||||
|
focusRibbon: doc('Focus ribbon',
|
||||||
|
function(target){
|
||||||
|
var cur = this.data.getRibbonIndex()
|
||||||
|
var ribbon = this.data.getRibbon(target)
|
||||||
|
var t = this.data.getRibbonIndex(ribbon)
|
||||||
|
|
||||||
|
// XXX revise this...
|
||||||
|
var direction = t < cur ? 'before' : 'after'
|
||||||
|
|
||||||
|
return this.focusImage(
|
||||||
|
this.data.getImage(ribbon, direction))
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**********************************************************************
|
||||||
|
* vim:set ts=4 sw=4 : */
|
||||||
|
return module })
|
||||||
@ -621,6 +621,12 @@ module.DataPrototype = {
|
|||||||
// .getRibbon('base')
|
// .getRibbon('base')
|
||||||
// -> base ribbon gid
|
// -> base ribbon gid
|
||||||
//
|
//
|
||||||
|
// Get ribbon before/after current
|
||||||
|
// .getRibbon('before')
|
||||||
|
// .getRibbon('after')
|
||||||
|
// -> gid
|
||||||
|
// -> null
|
||||||
|
//
|
||||||
// Get ribbon by target image/ribbon:
|
// Get ribbon by target image/ribbon:
|
||||||
// .getRibbon(ribbon|order|gid)
|
// .getRibbon(ribbon|order|gid)
|
||||||
// -> ribbon gid
|
// -> ribbon gid
|
||||||
@ -642,6 +648,12 @@ module.DataPrototype = {
|
|||||||
// NOTE: this expects ribbon order and not image order.
|
// NOTE: this expects ribbon order and not image order.
|
||||||
getRibbon: function(target, offset){
|
getRibbon: function(target, offset){
|
||||||
target = target == null ? this.current : target
|
target = target == null ? this.current : target
|
||||||
|
|
||||||
|
if(target == 'before' || target == 'after'){
|
||||||
|
target = this.current
|
||||||
|
offset = target
|
||||||
|
}
|
||||||
|
|
||||||
offset = offset == null ? 0 : offset
|
offset = offset == null ? 0 : offset
|
||||||
offset = offset == 'before' ? -1 : offset
|
offset = offset == 'before' ? -1 : offset
|
||||||
offset = offset == 'after' ? 1 : offset
|
offset = offset == 'after' ? 1 : offset
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user