tweaking .direction

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2019-01-02 05:47:21 +03:00
parent 74f83dd637
commit c0ca5bc13e
2 changed files with 19 additions and 1 deletions

View File

@ -150,7 +150,7 @@ actions.Actions({
|| 'right'
: value
var steps = this.config['steps-to-change-direction']
var steps = this.direction_change_steps
var direction = this.__direction || new Array(steps)
// value ends with '!' -> force direction change...
@ -179,6 +179,12 @@ actions.Actions({
// step in the opposite direction...
: direction.slice(0, -1)
},
// NOTE: these are set-up as props to enable dynamic customization...
// XXX not sure this is a good way to go...
get direction_change_steps(){
return this.config['steps-to-change-direction'] },
set direction_change_steps(value){
this.config['steps-to-change-direction'] = value },
// Consistency checking...

View File

@ -131,6 +131,9 @@ var base = require('features/base')
var ViewerActions =
module.ViewerActions = actions.Actions({
config: {
// make the direction steps depend on screen size...
'steps-to-change-direction': 'screenwidth',
// The maximum screen width allowed when zooming...
'max-screen-images': 30,
@ -319,6 +322,15 @@ module.ViewerActions = actions.Actions({
'ribbon-image-separators',
function(state){ this.config['ribbon-image-separators'] = state }) ],
// XXX EXPERIMENTAL: direction...
get direction_change_steps(){
var steps = this.config['steps-to-change-direction']
return steps == 'screenwidth' ?
Math.ceil(this.screenwidth / 2)
: typeof(steps) == typeof(123) ?
steps
: Math.ceil(this.screenwidth / 2) },
// Navigation...
//