Mercurial > hg > digilib-old
changeset 764:f640f1fe8f80 jquery
merge
with 31664707999e6f7a1e9c7129958b13376c7429e8
author | robcast |
---|---|
date | Thu, 10 Feb 2011 13:01:10 +0100 |
parents | aab01da232ef (current diff) 31664707999e (diff) |
children | 8d5239d7b1d4 68b0c7a8ca7c |
files | |
diffstat | 1 files changed, 22 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/client/digitallibrary/jquery/jquery.digilib.js Thu Feb 10 09:20:56 2011 +0100 +++ b/client/digitallibrary/jquery/jquery.digilib.js Thu Feb 10 13:01:10 2011 +0100 @@ -342,6 +342,10 @@ } } } + // get image info from server if needed + if (data.scaleMode === 'pixel' || data.scaleMode === 'size') { + getImageInfo(data); // TODO: onload callback + } // create HTML structure for scaler setupScalerDiv(data); // add buttons @@ -385,7 +389,6 @@ settings.isBirdDivVisible = showDiv(settings.isBirdDivVisible, data.$birdDiv, show); updateBirdDiv(data); storeOptions(data); - // data.$birdImg.triggerHandler('load'); // TODO: we shouldn't do that }, // goto given page nr (+/-: relative) @@ -599,10 +602,12 @@ } if (mode != null) { setScaleMode(data, mode); + data.scaleMode = mode; redisplay(data); } } - + + // end of actions }; // returns parameters from page url @@ -745,6 +750,7 @@ } } data.scalerFlags = flags; + data.scaleMode = getScaleMode(data); retrieveOptions(data); }; @@ -1097,8 +1103,19 @@ }; // create Transform from area and $img - var getImgTrafo = function ($img, area, rot, hmir, vmir) { + var getImgTrafo = function ($img, area, rot, hmir, vmir, mode, imgInfo) { var picrect = geom.rectangle($img); + if (mode != null) { + if (mode === 'pixel') { + // scaler mo=clip - image area size does not come from ww, wh + if (imgInfo != null) { + area.width = picrect.width / imgInfo.width; + area.height = picrect.height / imgInfo.height; + } else { + console.error("No image info for pixel mode!"); + } + } + } var trafo = geom.transform(); // move zoom area offset to center trafo.concat(trafo.getTranslation(geom.position(-area.x, -area.y))); @@ -1136,7 +1153,8 @@ var $scaler = data.$scaler; // create Transform from current zoomArea and image size data.imgTrafo = getImgTrafo($img, data.zoomArea, - data.settings.rot, data.scalerFlags.hmir, data.scalerFlags.vmir); + data.settings.rot, data.scalerFlags.hmir, data.scalerFlags.vmir, + data.scaleMode, data.imgInfo); // console.debug("imgTrafo=", data.imgTrafo); var imgRect = geom.rectangle($img); // console.debug("imgrect=", imgRect);