Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2012-08-15 03:02:27 +04:00
parent 3c12dedafa
commit f9941d2edc
2 changed files with 27 additions and 2 deletions

View File

@ -31,6 +31,9 @@ var ImageGrid = {
call[i] = obj[i]
}
this[obj.title] = call
if(this._type_handler[obj.type] != null){
this._type_handler[obj.type](obj)
}
return call
},
// define an option...
@ -38,14 +41,35 @@ var ImageGrid = {
this.option[obj.name] = obj.value
this.option_props[obj.name] = obj
},
_type_handler: {
/* XXX also need to make the action change the option...
toggle: function(obj){
// XXX add an option to store the state...
ImageGrid.OPTION({
name: obj.title,
doc: 'Stores the state of '+obj.title+' action.',
value: ImageGrid[obj.title]('?'),
callback: function(){
ImageGrid[obj.title](ImageGrid.option[obj.title])
}
})
},
*/
},
}
ImageGrid.ACTION({
title: 'set',
doc: 'Set an option\'s value, calling apropriate callbacks.',
group: 'API',
call: function (obj){
for(var n in obj){
this.option[n] = obj[n]
}
// NOTE: this seporate so as to remove the posibility of race
// conditions...
// ...thogh there is still a posibility of conflicting modes
for(var n in obj){
// call the callback if it exists...
if(this.option_props[n].callback != null){
this.option_props[n].callback()
@ -56,6 +80,7 @@ ImageGrid.ACTION({
ImageGrid.ACTION({
title: 'doc',
doc: 'get documentation for name.',
group: 'API',
call: function(name){
return {
action: this[name] != null ? this[name].doc : null,

View File

@ -14,8 +14,8 @@ var keybindings = {
// zooming...
187: function(){scaleContainerBy(ZOOM_FACTOR)}, // +
189: function(){scaleContainerBy(1/ZOOM_FACTOR)}, // -
187: function(){scaleContainerBy(ImageGrid.option.ZOOM_FACTOR)}, // +
189: function(){scaleContainerBy(1/ImageGrid.option.ZOOM_FACTOR)}, // -
// zoom presets...
48: {
'default': fitImage, // 0