make sizing configuration more friendly to different screen sizes + moved some to CONFIG...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2014-01-15 22:52:28 +04:00
parent 3a96a5a08a
commit 2ace671030
4 changed files with 16 additions and 6 deletions

View File

@ -123,9 +123,14 @@ var CONFIG = {
// NOTE: The value should be >1 or zooming will be reversed.
zoom_step_scale: 1.2,
// ribbon scaling limits and defaults...
// ribbon scaling limits and defaults (pixels)...
// ~10 images per screen @ 1024x768
min_image_size: 100,
default_screen_images: 4,
// ~4 images per screen @ 1024x768
default_image_size: 250,
single_image_scale_2: 1.125,
single_image_scale_3: 3,
// localStorage prefix...
data_attr: 'DATA',
@ -2272,7 +2277,9 @@ function reloadViewer(reuse_current_structure, images_per_screen){
var current = DATA.current
// if no width is given, use the current or default...
var w = images_per_screen == null ? getScreenWidthInImages() : images_per_screen
w = w > getScreenWidthInImages(CONFIG.min_image_size) ? CONFIG.default_screen_images : w
w = w > getScreenWidthInImages(CONFIG.min_image_size)
? getScreenWidthInImages(CONFIG.default_image_size)
: w
// reset data structure...
if(!reuse_current_structure){

View File

@ -53,6 +53,7 @@
<script>
//DEBUG = true
var SCROLLER_ENABLED = true

View File

@ -609,8 +609,8 @@ var KEYBOARD_CONFIG = {
// zooming...
'#1': doc('Fit image to screen', function(){ fitNImages(1) }),
'#2': doc('Show big image', function(){ fitNImages(1.125) }),
'#3': doc('Show small image', function(){ fitNImages(3) }),
'#2': doc('Show big image', function(){ fitNImages(CONFIG.single_image_scale_2) }),
'#3': doc('Show small image', function(){ fitNImages(CONFIG.single_image_scale_3) }),
'-': doc('Zoom in', function(){ zoomOut() }),
'=': doc('Zoom out', function(){ zoomIn() }),

View File

@ -153,7 +153,9 @@ var toggleSingleImageMode = createCSSClassToggler(
// load things...
w = UI_STATE['ribbon-mode-screen-images']
w = w == null ? CONFIG.default_screen_images : w
w = w == null
? getScreenWidthInImages(CONFIG.default_image_size)
: w
fitNImages(w)
var i = UI_STATE['ribbon-mode-image-info'] == 'on' ? 'on' : 'off'