From c0ca5bc13e0afd692a7eabbb7464f8bfb0504f34 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Wed, 2 Jan 2019 05:47:21 +0300 Subject: [PATCH] tweaking .direction Signed-off-by: Alex A. Naanou --- ui (gen4)/features/base.js | 8 +++++++- ui (gen4)/features/ui.js | 12 ++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/ui (gen4)/features/base.js b/ui (gen4)/features/base.js index b547a5ed..dba0a79b 100755 --- a/ui (gen4)/features/base.js +++ b/ui (gen4)/features/base.js @@ -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... diff --git a/ui (gen4)/features/ui.js b/ui (gen4)/features/ui.js index f3a9e74e..ded865a9 100755 --- a/ui (gen4)/features/ui.js +++ b/ui (gen4)/features/ui.js @@ -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... //