changeset 719:3da6db751448 jquery

change birdview along with scalerUrl in embedded mode
author hertzhaft
date Mon, 31 Jan 2011 10:05:49 +0100
parents d6d486fe44c2
children 4f96149cf584 123706249227
files client/digitallibrary/jquery/jquery.digilib.js
diffstat 1 files changed, 25 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/client/digitallibrary/jquery/jquery.digilib.js	Sun Jan 30 22:06:45 2011 +0100
+++ b/client/digitallibrary/jquery/jquery.digilib.js	Mon Jan 31 10:05:49 2011 +0100
@@ -238,6 +238,8 @@
         // dimensions of bird's eye div
         'birdDivWidth' : 200, 
         'birdDivHeight' : 200,
+        // parameters used by bird's eye div
+        'birdDivParams' : ['fn','pn','dw','dh'],
         // style of the zoom area indicator in the bird's eye div 
         'birdIndicatorStyle' : {'border' : '2px solid #ff0000' },
         // style of zoom area "rubber band"
@@ -784,7 +786,9 @@
             data.$img.attr('src', url);
             // set scaler div size explicitly in case $img is hidden (for zoomDrag)
             $imgRect = geom.rectangle(data.$img);
-            $imgRect.adjustDiv(data.$scaler); 
+            $imgRect.adjustDiv(data.$scaler);
+            // load new bird img (in case the scalerUrl has changed, like in gotopage)
+            showBirdDiv(data);
             }
     };
 
@@ -912,15 +916,6 @@
     // creates HTML structure for the bird's eye view in elem
     var setupBirdDiv = function (data) {
         var $elem = data.$elem;
-        var settings = data.settings;
-        // use only the relevant parameters
-        var keys = ['fn','pn','dw','dh'];
-        var birdDivOptions = {
-            dw : settings.birdDivWidth,
-            dh : settings.birdDivHeight
-            };
-        var birdSettings = $.extend({}, settings, birdDivOptions);
-        var birdUrl = settings.scalerBaseUrl + '?' + getParamString(birdSettings, keys);
         // the bird's eye div
         var $birdDiv = $('<div class="birdview" style="display:none"/>');
         // the detail indicator frame
@@ -935,12 +930,30 @@
         data.$birdZoom = $birdZoom;
         data.$birdImg = $birdImg;
         $birdImg.load(birdImgLoadedHandler(data));
+        showBirdDiv(data);
+        birdZoom(data);
+    };
+    
+    // puts correct img into bird div
+    var showBirdDiv = function (data) {
+        var settings = data.settings;
+        var $birdImg = data.$birdImg;
+        var $birdDiv = data.$birdDiv;
+        var birdDivOptions = {
+            dw : settings.birdDivWidth,
+            dh : settings.birdDivHeight
+            };
+        var birdSettings = $.extend({}, settings, birdDivOptions);
+        // use only the relevant parameters
+        var birdUrl = settings.scalerBaseUrl + '?' 
+            + getParamString(birdSettings, settings.birdDivParams);
+        // the bird's eye div
         $birdImg.attr('src', birdUrl);
-        if (data.settings.isBirdDivVisible) {
+        if (settings.isBirdDivVisible) {
             $birdDiv.show();
             }
-        birdZoom(data);
     };
+    
 
     // creates HTML structure for the about view in elem
     var setupAboutDiv = function (data) {