changeset 747:fd4842f0afc7 jquery

smoother birdZoom indicator movement; fixed bug in jQuery.offset()
author hertzhaft
date Sat, 05 Feb 2011 13:53:45 +0100
parents 2e9a48dc7a0c
children 4b9349765b9c
files client/digitallibrary/jquery/jquery-1.4.4.js client/digitallibrary/jquery/jquery.digilib.js
diffstat 2 files changed, 9 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/client/digitallibrary/jquery/jquery-1.4.4.js	Fri Feb 04 00:02:06 2011 +0100
+++ b/client/digitallibrary/jquery/jquery-1.4.4.js	Sat Feb 05 13:53:45 2011 +0100
@@ -6997,8 +6997,10 @@
 			curPosition = curElem.position();
 		}
 
-		curTop  = calculatePosition ? curPosition.top  : parseInt( curCSSTop,  10 ) || 0;
-		curLeft = calculatePosition ? curPosition.left : parseInt( curCSSLeft, 10 ) || 0;
+		// curTop  = calculatePosition ? curPosition.top  : parseInt( curCSSTop,  10 ) || 0;
+		// curLeft = calculatePosition ? curPosition.left : parseInt( curCSSLeft, 10 ) || 0;
+		curTop  = calculatePosition ? curPosition.top  : parseFloat( curCSSTop ) || 0;
+		curLeft = calculatePosition ? curPosition.left : parseFloat( curCSSLeft ) || 0;
 
 		if ( jQuery.isFunction( options ) ) {
 			options = options.call( elem, i, curOffset );
--- a/client/digitallibrary/jquery/jquery.digilib.js	Fri Feb 04 00:02:06 2011 +0100
+++ b/client/digitallibrary/jquery/jquery.digilib.js	Sat Feb 05 13:53:45 2011 +0100
@@ -1302,8 +1302,6 @@
             fullRect = setZoomBG(data); // setup zoom background image
             $document.bind("mousemove.dlBirdMove", birdZoomMove);
             $document.bind("mouseup.dlBirdMove", birdZoomEndDrag);
-            // $birdZoom.bind("mousemove.dlBirdMove", birdZoomMove);
-            // $birdZoom.bind("mouseup.dlBirdMove", birdZoomEndDrag);
             return false;
         };
 
@@ -1314,8 +1312,9 @@
             // move birdZoom div, keeping size
             newRect = birdZoomRect.copy();
             newRect.addPosition(delta);
-            // stay within birdimage
             newRect.stayInside(birdImgRect);
+            // acount for border width
+            newRect.addPosition({x : -2, y : -2});
             newRect.adjustDiv($birdZoom);
             // reflect birdview zoom position in scaler image
             // TODO: account for scaler position in embedded mode?
@@ -1339,13 +1338,13 @@
             var settings = data.settings;
             $document.unbind("mousemove.dlBirdMove", birdZoomMove);
             $document.unbind("mouseup.dlBirdMove", birdZoomEndDrag);
-            // $birdZoom.unbind("mousemove.dlBirdMove", birdZoomMove);
-            // $birdZoom.unbind("mouseup.dlBirdMove", birdZoomEndDrag);
             if (newRect == null) { 
                 // no movement happened - set center to click position
                 startPos = birdZoomRect.getCenter();
                 birdZoomMove(evt); 
                 }
+            // ugly, but needed to prevent double border width compensation
+            newRect.addPosition({x : +2, y : +2});
             var newArea = data.birdTrafo.invtransform(newRect);
             data.zoomArea = newArea;
             redisplay(data);
@@ -1366,7 +1365,7 @@
     // move bird zoom indicator to reflect zoomed detail area
     var setBirdZoom = function(data, rect) {
         var part = data.imgTrafo.invtransform(rect);
-        // area = FULL_AREA.fit(part); // we want to see where we transcend the borders
+        // area = FULL_AREA.fit(part); // no, we want to see where we transcend the borders
         birdTrafo = getImgTrafo(data.$birdImg, FULL_AREA);
         var birdRect = birdTrafo.transform(part);
         // acount for border width