From d51f567a15600cbd8ece1e9972b36f6fcb78e7f0 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Tue, 31 Jul 2012 17:38:50 +0400 Subject: [PATCH] added ribbon align for prev and next ribbons... Signed-off-by: Alex A. Naanou --- ui/gallery-prototype.js | 17 ++++++++++++++++- ui/ui.js | 4 ++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/ui/gallery-prototype.js b/ui/gallery-prototype.js index 6a1b1e14..14da6938 100755 --- a/ui/gallery-prototype.js +++ b/ui/gallery-prototype.js @@ -93,7 +93,21 @@ function setCurrentImage(){ centerSquare() // center other ribbons relative to current image... - // XXX + // XXX only two ribbons are positioned at this point... + var id = $('.current.image').attr('id') + var directions = ['prev', 'next'] + for(var i in directions){ + var ribbon = $('.current.ribbon')[directions[i]]('.ribbon') + if(ribbon.length == 1){ + var img = getImageBefore(id, ribbon) + if(img != null){ + alignRibbon(img, 'before') + } else { + // there are no images before... + alignRibbon(ribbon.children('.image').first(), 'after') + } + } + } } @@ -134,6 +148,7 @@ function handleImageClick(e) { +// this sets the zooming factor used in manual zooming... var ZOOM_FACTOR = 2 // key configuration... diff --git a/ui/ui.js b/ui/ui.js index 527a88df..3db46236 100755 --- a/ui/ui.js +++ b/ui/ui.js @@ -121,13 +121,13 @@ function alignRibbon(image, position){ switch(position){ case 'before': - ribbon.css({'margin-left': h_offset + w/2}) + ribbon.css({'margin-left': h_offset - w/2}) return true case 'center': ribbon.css({'margin-left': h_offset}) return true case 'after': - ribbon.css({'margin-left': h_offset - w/2}) + ribbon.css({'margin-left': h_offset + w/2}) return true } return false