mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 10:20:08 +00:00
experementing...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
f903d71382
commit
31f51ff6ac
@ -340,9 +340,12 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* make buttons a bit different in action browser... */
|
/* 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);
|
background-color: rgba(0, 0, 0, 0.12);
|
||||||
}
|
}
|
||||||
|
.dark .browse-widget.browse-actions .list .button {
|
||||||
|
background-color: rgba(255, 255, 255, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -177,6 +177,75 @@ var LocationActions = actions.Actions({
|
|||||||
|
|
||||||
return res
|
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({
|
module.Location = core.ImageGridFeatures.Feature({
|
||||||
|
|||||||
@ -132,6 +132,8 @@ var PartialRibbonsActions = actions.Actions({
|
|||||||
// - revise .updateImage(..)
|
// - revise .updateImage(..)
|
||||||
//
|
//
|
||||||
// Q: can this be done within 1/60s???
|
// Q: can this be done within 1/60s???
|
||||||
|
// XXX one approach here might be:
|
||||||
|
// wait for images to preload and only then update...
|
||||||
} else {
|
} else {
|
||||||
//console.log('UPDATE', t - this.__last_ribbon_update)
|
//console.log('UPDATE', t - this.__last_ribbon_update)
|
||||||
var c = gids.indexOf(data.getImage('current', r_gid))
|
var c = gids.indexOf(data.getImage('current', r_gid))
|
||||||
|
|||||||
@ -1504,6 +1504,7 @@ var RibbonsPrototype = {
|
|||||||
return image[0]
|
return image[0]
|
||||||
}))
|
}))
|
||||||
},
|
},
|
||||||
|
// XXX add options for images to preload and only then do the update...
|
||||||
updateImage: function(image, gid, size, sync, callback){
|
updateImage: function(image, gid, size, sync, callback){
|
||||||
var that = this
|
var that = this
|
||||||
image = (image == '*' ? this.viewer.find(IMAGE)
|
image = (image == '*' ? this.viewer.find(IMAGE)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user