# HG changeset patch # User hertzhaft # Date 1297013141 -3600 # Node ID 4c0cc97a63993c69524c50e5d4b1fd1df63eed0a # Parent ce5a0e6b5ee9986f01a017543e110fe11e1e0a0d ugly workaround for IE7 image load handler bug diff -r ce5a0e6b5ee9 -r 4c0cc97a6399 client/digitallibrary/jquery/jquery-test-full.html --- a/client/digitallibrary/jquery/jquery-test-full.html Sun Feb 06 00:12:47 2011 +0100 +++ b/client/digitallibrary/jquery/jquery-test-full.html Sun Feb 06 18:25:41 2011 +0100 @@ -9,6 +9,18 @@ background: silver; } + #debug { + background-color: beige; + position: absolute; + opacity: 50%; + top: 4px; + left: 300px; + width: 500px; + padding: 0px 5px; + font-family: Arial; + font-size: 9px; + } + @@ -35,6 +47,7 @@
+
DEBUG
diff -r ce5a0e6b5ee9 -r 4c0cc97a6399 client/digitallibrary/jquery/jquery.digilib.js --- a/client/digitallibrary/jquery/jquery.digilib.js Sun Feb 06 00:12:47 2011 +0100 +++ b/client/digitallibrary/jquery/jquery.digilib.js Sun Feb 06 18:25:41 2011 +0100 @@ -356,7 +356,7 @@ // about window creation - TODO: could be deferred? restrict to only one item? setupAboutDiv(data); // drag zoom area around in scaler div - setupZoomDrag(data); + // setupZoomDrag(data); // is done in scalerImgLoadedHandler() }); }, @@ -1143,10 +1143,13 @@ // returns function for load event of bird's eye view img var birdImgLoadedHandler = function (data) { return function () { - var $img = $(this); - console.debug("birdimg loaded! this=", this, " data=", data); - // create Transform from current area and picsize - data.birdTrafo = getImgTrafo($img, FULL_AREA); + var $birdImg = $(this); + var birdRect = geom.rectangle($birdImg); + console.debug("birdImg loaded!", $birdImg, "rect=", birdRect, "data=", data); + if (birdRect.width === 0) { + // malheureusement IE7 calls load handler when there is no size info yet + setTimeout(function () { $birdImg.triggerHandler('load') }, 200); + } // display red indicator around zoomarea renderBirdArea(data); // enable click and drag @@ -1185,9 +1188,10 @@ } else { $birdZoom.show(); } - // position may have changed + // create Transform from current area and picsize data.birdTrafo = getImgTrafo(data.$birdImg, FULL_AREA); var zoomRect = data.birdTrafo.transform(zoomArea); + console.debug("renderBirdArea:", zoomRect, "zoomArea:", zoomArea, "$birdTrafo:", data.birdTrafo); // acount for border width zoomRect.addPosition({x : -2, y : -2}); if (data.settings.interactionMode === 'fullscreen') { @@ -1198,10 +1202,11 @@ // correct offsetParent because animate doesn't use offset var ppos = $birdZoom.offsetParent().offset(); var dest = { - left : (zoomRect.x - ppos.left) + 'px', - top : (zoomRect.y - ppos.top) + 'px', - width : zoomRect.width, - height : zoomRect.height}; + left : (zoomRect.x - ppos.left) + 'px', + top : (zoomRect.y - ppos.top) + 'px', + width : zoomRect.width, + height : zoomRect.height + }; $birdZoom.animate(dest); } }; @@ -1340,7 +1345,6 @@ var imgArea = data.imgTrafo.transform(area); var offset = imgArea.getPosition().neg(); offset.add(scalerPos); - console.log('offset', offset); if (fullRect) { var bgPos = fullRect.getPosition().add(offset); } else {