From 0d108eb5f11207fb9569f35e5d95c570eb7c5cf2 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Mon, 25 Nov 2013 05:12:01 +0400 Subject: [PATCH] some cleanup... Signed-off-by: Alex A. Naanou --- ui/data.js | 11 +++-------- ui/ribbons.js | 6 +++++- ui/setup.js | 2 -- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/ui/data.js b/ui/data.js index ed592ac3..3af3bfdf 100755 --- a/ui/data.js +++ b/ui/data.js @@ -1229,6 +1229,9 @@ function updateImage(image, gid, size){ // flip... setImageFlipState(image, img_data.flipped == null ? [] : img_data.flipped) + // NOTE: this only has effect on non-square image blocks... + correctImageProportionsForRotation(image) + // marks... if(MARKED.indexOf(gid) != -1){ image.addClass('marked') @@ -1236,8 +1239,6 @@ function updateImage(image, gid, size){ image.removeClass('marked') } - correctImageProportionsForRotation(image) - return image } @@ -1465,9 +1466,6 @@ function loadImagesAround(count, gid, ribbon, data){ $('.viewer').trigger('updatedRibbon', [ribbon_elem]) } - // XXX is this the right place for this? - // XXX this might be too global, do only the images loaded... - //correctImageProportionsForRotation(images) return images } @@ -1516,8 +1514,6 @@ function rollImages(n, ribbon, extend, no_compensate_shift){ $('.viewer').trigger('updatedRibbon', [ribbon]) - // XXX is this the right place for this? - //correctImageProportionsForRotation(images) return images } @@ -1541,7 +1537,6 @@ function reloadViewer(images_per_screen){ // create images... $('.ribbon').each(function(i, e){ - //loadImages(current, Math.min(w * LOAD_SCREENS, DATA.ribbons[i].length), $(this)) loadImagesAround(Math.round(w * LOAD_SCREENS), current, i) }) diff --git a/ui/ribbons.js b/ui/ribbons.js index d494f6c6..a801015a 100755 --- a/ui/ribbons.js +++ b/ui/ribbons.js @@ -837,7 +837,11 @@ function nextRibbon(){ // Compensate for viewer proportioned and rotated images. // -// NOTE: this is not neede for square image blocks. +// This will set the margins so as to make the rotated image offset the +// same space as it is occupying visually... +// +// NOTE: this is not needed for square image blocks. +// NOTE: if an image block is square, this will remove the margins. function correctImageProportionsForRotation(images){ var viewer = $('.viewer') var W = viewer.innerWidth() diff --git a/ui/setup.js b/ui/setup.js index 3cb66282..40fe8abb 100755 --- a/ui/setup.js +++ b/ui/setup.js @@ -99,7 +99,6 @@ function setupDataBindings(viewer){ // likely due to shifting... || ( gr.length > l && l < Math.round(screen_size * LOAD_SCREENS))){ - //loadImages(gid, Math.round(screen_size * LOAD_SCREENS), ribbon) loadImagesAround(Math.round(screen_size * LOAD_SCREENS), gid, ribbon) // roll the ribbon while we are advancing... @@ -175,7 +174,6 @@ function setupDataBindings(viewer){ var gid = getImageGID() $('.ribbon').each(function(){ var r = $(this) - //loadImages(gid, Math.round(screen_size * LOAD_SCREENS), r) loadImagesAround(Math.round(screen_size * LOAD_SCREENS), gid, r) }) centerView(null, 'css')