mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 18:30:09 +00:00
added Toggler example...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
924f88fdae
commit
30be5132e6
@ -7,6 +7,7 @@
|
|||||||
(function(require){ var module={} // make module AMD/node compatible...
|
(function(require){ var module={} // make module AMD/node compatible...
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
|
|
||||||
|
var toggler = require('lib/toggler')
|
||||||
var actions = require('lib/actions')
|
var actions = require('lib/actions')
|
||||||
var features = require('lib/features')
|
var features = require('lib/features')
|
||||||
|
|
||||||
@ -72,10 +73,52 @@ var ExampleActions = actions.Actions({
|
|||||||
|
|
||||||
// Togglers...
|
// Togglers...
|
||||||
//
|
//
|
||||||
// XXX ...
|
// XXX add example argument handling...
|
||||||
exampleToggler: ['- Test/',
|
exampleToggler: ['- Test/',
|
||||||
|
toggler.Toggler(null,
|
||||||
|
// state accessor...
|
||||||
|
function(_, state){
|
||||||
|
// get the state...
|
||||||
|
if(state == null){
|
||||||
|
return this.__example_toggler_state || 'none'
|
||||||
|
|
||||||
|
// handle state changing...
|
||||||
|
} else if(state == 'none'){
|
||||||
|
delete this.__example_toggler_state
|
||||||
|
|
||||||
|
} else {
|
||||||
|
this.__example_toggler_state = state
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// List of states...
|
||||||
|
// NOTE: this can be a string for bool states and a list for
|
||||||
|
// togglers with multiple states...
|
||||||
|
'A')],
|
||||||
|
exampleTogglerFull: ['- Test/',
|
||||||
|
toggler.Toggler(null,
|
||||||
|
// state accessor...
|
||||||
|
function(_, state){
|
||||||
|
// get the state...
|
||||||
|
if(state == null){
|
||||||
|
return this.__example_toggler_state || 'A'
|
||||||
|
|
||||||
|
} else if(state == 'A'){
|
||||||
|
delete this.__example_toggler_state
|
||||||
|
|
||||||
|
} else {
|
||||||
|
this.__example_toggler_state = state
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// List of states...
|
||||||
|
['A', 'B', 'C'],
|
||||||
|
// pre-callback (optional)
|
||||||
function(){
|
function(){
|
||||||
}],
|
console.log('Changing state from:', this.exampleTogglerFull('?'))
|
||||||
|
},
|
||||||
|
// post-callback...
|
||||||
|
function(){
|
||||||
|
console.log('Changing state to:', this.exampleTogglerFull('?'))
|
||||||
|
})],
|
||||||
|
|
||||||
// XXX docs...
|
// XXX docs...
|
||||||
// XXX BUG? false is not shown in the dialog button...
|
// XXX BUG? false is not shown in the dialog button...
|
||||||
|
|||||||
@ -562,10 +562,10 @@ core.ImageGridFeatures.Feature({
|
|||||||
'crop',
|
'crop',
|
||||||
'uncrop',
|
'uncrop',
|
||||||
'removeFromCrop',
|
'removeFromCrop',
|
||||||
|
'reverseImages',
|
||||||
],
|
],
|
||||||
function(target){ return this.reload(true) }],
|
function(target){ return this.reload(true) }],
|
||||||
[[
|
[[
|
||||||
'reverseImages',
|
|
||||||
'reverseRibbons',
|
'reverseRibbons',
|
||||||
'cropGroup',
|
'cropGroup',
|
||||||
'syncTags',
|
'syncTags',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user