experementing...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2017-04-24 14:34:09 +03:00
parent f903d71382
commit 31f51ff6ac
4 changed files with 76 additions and 1 deletions

View File

@ -340,9 +340,12 @@ body {
}
/* make buttons a bit different in action browser... */
.browse-widget.browse-actions.show-keys .list .button {
.browse-widget.browse-actions .list .button {
background-color: rgba(0, 0, 0, 0.12);
}
.dark .browse-widget.browse-actions .list .button {
background-color: rgba(255, 255, 255, 0.2);
}

View File

@ -177,6 +177,75 @@ var LocationActions = actions.Actions({
return res
}],
// XXX need a way to get save method...
// - rename .location.method to .location.load and add .location.save
// - treat method as protocol and add a method registry API
// this is more flexible as we can add as many methods per
// protocol as we need and add a command action:
// - execute command in current protocol
// .locationCall("command", ...)
// - execute command in specific protocol
// .locationCall('protocol:command', ..)
// - show current protocol
// .locationCall("?")
// - list commands
// .locationCall("??")
// .locationCall('protocol:??')
// we can implicitly define protocols via action attrs:
// loadIndex: ['...',
// {locationProtocol: 'file:load'},
// function(){ ... }],
locationDispatch: ['- File/',
function(spec){
spec = spec instanceof Array ? spec : spec.split(':')
var args = [].slice.call(arguments, 1)
var action = spec.pop()
var protocol = spec.shift() || this.location.method
// format:
// {
// 'protocol:method': 'actionName',
// ...
// }
var cache = this.__location_protocol_cache =
this.__location_protocol_cache || this.cacheLocationProtocols()
// get protocol...
if(action == '?'){
return protocol
// get available methods for protocol...
} else if(action == '??'){
return Object.keys(cache)
.filter(function(e){ return e.startsWith(protocol + ':') })
.map(function(e){ return e.split(':').pop() })
// list all protocols...
} else if(protocol == '??' && action == '*'){
return Object.keys(cache)
.map(function(e){ return e.split(':').pop() })
.unique()
// list protocols implementing specific action...
} else if(protocol == '??'){
return Object.keys(cache)
.filter(function(e){ return e.endsWith(':'+ action) })
.map(function(e){ return e.split(':')[0] })
.unique()
// call method...
} else {
// XXX args???
this[cache[protocol +':'+ action]].call(this)
}
}],
saveLocation: ['- File/Save location',
function(location){
// XXX
this.locationDispatch('save')
}],
})
module.Location = core.ImageGridFeatures.Feature({

View File

@ -132,6 +132,8 @@ var PartialRibbonsActions = actions.Actions({
// - revise .updateImage(..)
//
// Q: can this be done within 1/60s???
// XXX one approach here might be:
// wait for images to preload and only then update...
} else {
//console.log('UPDATE', t - this.__last_ribbon_update)
var c = gids.indexOf(data.getImage('current', r_gid))

View File

@ -1504,6 +1504,7 @@ var RibbonsPrototype = {
return image[0]
}))
},
// XXX add options for images to preload and only then do the update...
updateImage: function(image, gid, size, sync, callback){
var that = this
image = (image == '*' ? this.viewer.find(IMAGE)