mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-28 18:00:09 +00:00
some refactoring + new custom sizes in single image view...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
787167ee51
commit
f0f972ae12
@ -25,6 +25,15 @@ var drawer = require('lib/widget/drawer')
|
||||
|
||||
/*********************************************************************/
|
||||
|
||||
// helper...
|
||||
function customScale(n){
|
||||
return {
|
||||
default: 'fitCustom: '+n,
|
||||
'ctrl+shift': 'setCustomSize: '+n,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// XXX might be a good idea to be able ignore actions rather than keys...
|
||||
// XXX add this to the global doc...
|
||||
var GLOBAL_KEYBOARD =
|
||||
@ -72,8 +81,22 @@ module.GLOBAL_KEYBOARD = {
|
||||
],
|
||||
|
||||
'#1': 'fitScreen',
|
||||
'#2': 'fitNormal',
|
||||
'#3': 'fitSmall',
|
||||
'#2': {
|
||||
default: 'fitNormal',
|
||||
'ctrl+shift': 'setNormalScale',
|
||||
},
|
||||
'#3': {
|
||||
default: 'fitSmall',
|
||||
'ctrl+shift': 'setSmallScale',
|
||||
},
|
||||
'#4': customScale(4),
|
||||
'#5': customScale(5),
|
||||
'#6': customScale(6),
|
||||
'#7': customScale(7),
|
||||
'#8': customScale(8),
|
||||
'#9': customScale(9),
|
||||
'#0': customScale(0),
|
||||
|
||||
|
||||
Esc: 'toggleSingleImage: "off" -- Exit single image view',
|
||||
|
||||
|
||||
@ -83,6 +83,12 @@ var SingleImageActions = actions.Actions({
|
||||
'single-image-scale': 1.2,
|
||||
'ribbon-scale': 5,
|
||||
|
||||
// Scales for small and normal image sizes...
|
||||
'fit-small-scale': 4,
|
||||
'fit-normal-scale': 1.2,
|
||||
|
||||
'fit-custom-scale': {},
|
||||
|
||||
// Set scale 'units' for different viewes...
|
||||
//
|
||||
// NOTE: the units are actually properties used to get/set the values.
|
||||
@ -223,7 +229,6 @@ var SingleImageActions = actions.Actions({
|
||||
}
|
||||
}],
|
||||
|
||||
|
||||
toggleSingleImage: ['Interface/Toggle single image view',
|
||||
toggler.CSSClassToggler(
|
||||
function(){ return this.ribbons.viewer },
|
||||
@ -243,6 +248,46 @@ var SingleImageActions = actions.Actions({
|
||||
this.popWorkspace()
|
||||
}
|
||||
})],
|
||||
|
||||
|
||||
// basic single image view sizing...
|
||||
fitSmall: ['Zoom/Show small image',
|
||||
function(){ this.screenfit = this.config['fit-small-scale'] || 4 }],
|
||||
fitNormal: ['Zoom/Show normal image',
|
||||
function(){ this.screenfit = this.config['fit-normal-scale'] || 1.2 }],
|
||||
setSmallScale: ['Zoom/Set small size to current',
|
||||
function(){ this.config['fit-small-scale'] = this.screenfit }],
|
||||
setNormalScale: ['Zoom/Set normal size to current',
|
||||
function(){ this.config['fit-normal-scale'] = this.screenfit }],
|
||||
|
||||
// XXX should we prevent setting sizes out of order???
|
||||
// ...i.e. key 8 sets bigger size than key 2
|
||||
fitCustom: ['- Zoom/',
|
||||
function(n){
|
||||
if(n == null){
|
||||
return
|
||||
}
|
||||
|
||||
var s = this.config['fit-custom-scale'][n]
|
||||
|
||||
if(s == null){
|
||||
return
|
||||
}
|
||||
|
||||
this.screenfit = s
|
||||
}],
|
||||
setCustomSize: ['- Zoom/',
|
||||
function(n){
|
||||
if(n == null){
|
||||
return
|
||||
}
|
||||
|
||||
var sizes = this.config['fit-custom-scale'] || {}
|
||||
sizes[n] = this.screenfit
|
||||
|
||||
// NOTE: we are resetting this for it to be stored correctly...
|
||||
this.config['fit-custom-scale'] = sizes
|
||||
}],
|
||||
})
|
||||
|
||||
|
||||
|
||||
@ -783,14 +783,9 @@ module.ViewerActions = actions.Actions({
|
||||
//
|
||||
fitMax: ['Zoom/Fit the maximum number of images',
|
||||
function(){ this.fitImage(this.config['max-screen-images']) }],
|
||||
fitSmall: ['Zoom/Show small image',
|
||||
function(){ this.screenfit = 4 }],
|
||||
fitNormal: ['Zoom/Show normal image',
|
||||
function(){ this.screenfit = 1.2 }],
|
||||
fitScreen: ['Zoom/Fit image to screen',
|
||||
function(){ this.screenfit = 1 }],
|
||||
|
||||
|
||||
// NOTE: these work by getting the target position from .data...
|
||||
shiftImageTo: [
|
||||
function(target){ return updateImagePosition(this, target) }],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user