changeset 953:3d5e7458f9ae

fixed birdseye region positioning after layout reflow. added zoom area aspect ration change detection -- does nothing yet.
author robcast
date Wed, 04 Jan 2012 11:28:46 +0100
parents e3dc84cbb766
children 36102de2301e
files webapp/src/main/webapp/jquery/jquery.digilib.birdseye.js webapp/src/main/webapp/jquery/jquery.digilib.geometry.js webapp/src/main/webapp/jquery/jquery.digilib.js
diffstat 3 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/webapp/src/main/webapp/jquery/jquery.digilib.birdseye.js	Wed Jan 04 00:31:39 2012 +0100
+++ b/webapp/src/main/webapp/jquery/jquery.digilib.birdseye.js	Wed Jan 04 11:28:46 2012 +0100
@@ -96,6 +96,7 @@
     };
 
     var handleRedisplay = function (evt) {
+    	// TODO: do we need this?
         console.debug("birdseye: handleRedisplay");
         var data = this;
         if (data.settings.isBirdDivVisible) {
@@ -193,6 +194,8 @@
         } else {
             $birdZoom.show();
         }
+        // update birdTrafo
+        data.birdTrafo = digilib.fn.getImgTrafo(data.$birdImg, FULL_AREA);        
         var zoomRect = data.birdTrafo.transform(zoomArea);
         console.debug("renderBirdArea:", zoomRect, "zoomArea:", zoomArea, "$birdTrafo:", data.birdTrafo);
         // acount for border width
--- a/webapp/src/main/webapp/jquery/jquery.digilib.geometry.js	Wed Jan 04 00:31:39 2012 +0100
+++ b/webapp/src/main/webapp/jquery/jquery.digilib.geometry.js	Wed Jan 04 11:28:46 2012 +0100
@@ -224,6 +224,10 @@
         that.getArea = function() {
             return (this.width * this.height);
         };
+        // returns the aspect ratio of this Rectangle
+        that.getAspect = function() {
+            return (this.width / this.height);
+        };
         // eliminates negative width and height
         that.normalize = function() {
             var p = this.getPt2();
--- a/webapp/src/main/webapp/jquery/jquery.digilib.js	Wed Jan 04 00:31:39 2012 +0100
+++ b/webapp/src/main/webapp/jquery/jquery.digilib.js	Wed Jan 04 11:28:46 2012 +0100
@@ -38,7 +38,7 @@
 
     var defaults = {
         // version of this script
-        'version' : 'jquery.digilib.js 2.1a1',
+        'version' : 'jquery.digilib.js 2.1b1',
         // logo url
         'logoUrl' : 'img/digilib-logo-text1.png',
         // homepage url (behind logo)
@@ -1332,6 +1332,11 @@
                 'cursor' : 'move'
         };
         if (newZoomArea != null) {
+        	// check if aspect ratio has changed
+        	if (newZoomArea.getAspect() !== data.zoomArea.getAspect()) {
+        		console.debug("aspect ratio changed!");
+        	}
+        	// get transform for new zoomArea
         	imgTrafo = getImgTrafo($img, newZoomArea, data.settings.rot,
 					data.scalerFlags.hmir, data.scalerFlags.vmir,
 					data.scaleMode, data);