added current.js and a minor change to .getRibbon(...)...

This commit is contained in:
U-YOGA\Alex 2014-08-29 19:06:45 +04:00 committed by Alex A. Naanou
parent 4b35ba2e5e
commit 565f712e60
3 changed files with 70 additions and 0 deletions

0
buildcache.py Normal file → Executable file
View File

58
ui (gen4)/client.js Executable file
View 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 })

View File

@ -621,6 +621,12 @@ module.DataPrototype = {
// .getRibbon('base')
// -> base ribbon gid
//
// Get ribbon before/after current
// .getRibbon('before')
// .getRibbon('after')
// -> gid
// -> null
//
// Get ribbon by target image/ribbon:
// .getRibbon(ribbon|order|gid)
// -> ribbon gid
@ -642,6 +648,12 @@ module.DataPrototype = {
// NOTE: this expects ribbon order and not image order.
getRibbon: function(target, offset){
target = target == null ? this.current : target
if(target == 'before' || target == 'after'){
target = this.current
offset = target
}
offset = offset == null ? 0 : offset
offset = offset == 'before' ? -1 : offset
offset = offset == 'after' ? 1 : offset