diff --git a/ui (gen4)/features/keyboard.js b/ui (gen4)/features/keyboard.js index d17ea521..c198e4cd 100755 --- a/ui (gen4)/features/keyboard.js +++ b/ui (gen4)/features/keyboard.js @@ -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', diff --git a/ui (gen4)/features/ui-single-image.js b/ui (gen4)/features/ui-single-image.js index 06f14ee0..fc819662 100755 --- a/ui (gen4)/features/ui-single-image.js +++ b/ui (gen4)/features/ui-single-image.js @@ -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 + }], }) diff --git a/ui (gen4)/features/ui.js b/ui (gen4)/features/ui.js index 362793ad..2622fbbc 100755 --- a/ui (gen4)/features/ui.js +++ b/ui (gen4)/features/ui.js @@ -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) }],