mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 10:20:08 +00:00
updated core.makeConfigToggler(..) to support bool states + single image mode tweaks...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
2651ed943f
commit
051cba3082
@ -69,7 +69,7 @@ actions.Actions({
|
||||
// If true, shift up/down will count as a left/right move...
|
||||
//
|
||||
// see .direction for details...
|
||||
'shifts-affect-direction': true,
|
||||
'shifts-affect-direction': 'on',
|
||||
|
||||
// Determines the image selection mode when focusing or moving
|
||||
// between ribbons...
|
||||
@ -140,7 +140,7 @@ actions.Actions({
|
||||
// Sets the number of steps to change direction (N)
|
||||
//
|
||||
// 'shifts-affect-direction'
|
||||
// If true, add last direction change before vertical shift to
|
||||
// If 'on', add last direction change before vertical shift to
|
||||
// direction counter (N)
|
||||
// This makes the direction change after several shifts up/down
|
||||
// "backwards" a bit faster.
|
||||
@ -449,7 +449,7 @@ actions.Actions({
|
||||
|
||||
this.data.shiftImageUp(cur)
|
||||
this.focusImage(next)
|
||||
this.config['shifts-affect-direction'] && (this.direction = '!')
|
||||
this.config['shifts-affect-direction'] == 'on' && (this.direction = '!')
|
||||
|
||||
// if a specific target is given, just shift it...
|
||||
} else {
|
||||
@ -473,7 +473,7 @@ actions.Actions({
|
||||
|
||||
this.data.shiftImageDown(cur)
|
||||
this.focusImage(next)
|
||||
this.config['shifts-affect-direction'] && (this.direction = '!')
|
||||
this.config['shifts-affect-direction'] == 'on' && (this.direction = '!')
|
||||
|
||||
// if a specific target is given, just shift it...
|
||||
} else {
|
||||
@ -507,6 +507,9 @@ actions.Actions({
|
||||
this.focusImage()
|
||||
}],
|
||||
|
||||
toggleShiftsAffectDirection: ['Interface/Shifts affect direction',
|
||||
core.makeConfigToggler('shifts-affect-direction', ['off', 'on'])],
|
||||
|
||||
shiftRibbonUp: ['Ribbon|Edit|Sort/Shift ribbon up',
|
||||
function(target){
|
||||
this.data.shiftRibbonUp(target)
|
||||
|
||||
@ -39,10 +39,12 @@ module.protocol = function(protocol, func){
|
||||
|
||||
// NOTE: if no toggler state is set this assumes that the first state
|
||||
// is the default...
|
||||
// NOTE: default states is [false, true]
|
||||
var makeConfigToggler =
|
||||
module.makeConfigToggler =
|
||||
function(attr, states, a, b){
|
||||
|
||||
states = states || [false, true]
|
||||
var pre = a
|
||||
// XXX is this a good default???
|
||||
//var post = b || function(action){ action != null && this.focusImage() }
|
||||
@ -50,10 +52,15 @@ function(attr, states, a, b){
|
||||
|
||||
return toggler.Toggler(null,
|
||||
function(_, action){
|
||||
var lst = states.constructor === Array ? states : states.call(this)
|
||||
var lst = states.constructor === Array ? states
|
||||
: states instanceof Function ? states.call(this)
|
||||
: states
|
||||
|
||||
if(action == null){
|
||||
return this.config[attr] || lst[lst.indexOf('none')] || lst[0]
|
||||
var cfg = this.config[attr]
|
||||
return cfg == null ?
|
||||
(lst[lst.indexOf('none')] || lst[0])
|
||||
: cfg
|
||||
|
||||
} else {
|
||||
this.config[attr] = action
|
||||
|
||||
@ -110,9 +110,11 @@ var SingleImageActions = actions.Actions({
|
||||
// workspace...
|
||||
'single-image-config-defaults': {
|
||||
'ribbon-focus-mode': 'order',
|
||||
'shifts-affect-direction': 'off',
|
||||
},
|
||||
},
|
||||
|
||||
// XXX make this accept args for debuging...
|
||||
updateImageProportions: ['- Interface/',
|
||||
function(){
|
||||
var that = this
|
||||
|
||||
@ -860,6 +860,7 @@ module.ViewerActions = actions.Actions({
|
||||
|
||||
|
||||
// ribbon rotation...
|
||||
//
|
||||
ribbonRotation: ['- Interface/',
|
||||
function(a){
|
||||
if(arguments.length > 0){
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user