Mercurial > hg > digilib-old
changeset 1075:1e4f4964e9c2
CLOSED - # 25: scroll arrows have wrong direction with mirror and rot
https://it-dev.mpiwg-berlin.mpg.de/tracs/digilib/ticket/25
author | robcast |
---|---|
date | Thu, 17 May 2012 19:29:28 +0200 |
parents | 7a815e1a6d96 |
children | b41dc00af960 |
files | webapp/src/main/webapp/jquery/jquery.digilib.arrows.js webapp/src/main/webapp/jquery/jquery.digilib.geometry.js webapp/src/main/webapp/jquery/jquery.digilib.js |
diffstat | 3 files changed, 27 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/webapp/src/main/webapp/jquery/jquery.digilib.arrows.js Fri May 04 16:23:56 2012 +0200 +++ b/webapp/src/main/webapp/jquery/jquery.digilib.arrows.js Thu May 17 19:29:28 2012 +0200 @@ -14,7 +14,7 @@ var defaults = { // arrow bars for moving the zoomed area 'showZoomArrows' : true, - // by what percentage should the arrows move the zoomed area? + // by what fraction should the arrows move the zoomed area? 'zoomArrowMoveFactor' : 0.5, // defaults for digilib buttons 'buttonSettings' : { @@ -66,8 +66,16 @@ moveZoomArea : function(data, dx, dy) { var za = data.zoomArea.copy(); var factor = data.settings.zoomArrowMoveFactor; - var deltaX = dx * factor * za.width; - var deltaY = dy * factor * za.height; + // rotate and mirror change direction of cooordinate system + var trafo = data.imgTrafo; + var tdx = (trafo.m00 > 0) ? dx : -dx; + var tdy = (trafo.m11 > 0) ? dy : -dy; + if (Math.abs(trafo.m00) < Math.abs(trafo.m01)) { + tdx = (trafo.m01 > 0) ? -dy : dy; + tdy = (trafo.m10 > 0) ? -dx : dx; + } + var deltaX = tdx * factor * za.width; + var deltaY = tdy * factor * za.height; var delta = geom.position(deltaX, deltaY); za.addPosition(delta); za = FULL_AREA.fit(za);
--- a/webapp/src/main/webapp/jquery/jquery.digilib.geometry.js Fri May 04 16:23:56 2012 +0200 +++ b/webapp/src/main/webapp/jquery/jquery.digilib.geometry.js Thu May 17 19:29:28 2012 +0200 @@ -368,8 +368,7 @@ } ; that.concat = function(trafA) { - // add Transform trafA to this Transform (i.e. this = trafC = trafA - // * this) + // add Transform trafA to this Transform (i.e. this = trafC = trafA * this) var trafC = {}; for ( var i = 0; i < 3; i++) { for ( var j = 0; j < 3; j++) {
--- a/webapp/src/main/webapp/jquery/jquery.digilib.js Fri May 04 16:23:56 2012 +0200 +++ b/webapp/src/main/webapp/jquery/jquery.digilib.js Thu May 17 19:29:28 2012 +0200 @@ -38,7 +38,7 @@ var defaults = { // version of this script - 'version' : 'jquery.digilib.js 2.1.6a4', + 'version' : 'jquery.digilib.js 2.1.7a0', // logo url 'logoUrl' : 'img/digilib-logo-text1.png', // homepage url (behind logo) @@ -1558,14 +1558,24 @@ * */ var canMove = function(data, movx, movy) { + var za = data.zoomArea; if (isFullArea(za)) return false; + var dx = movx; + var dy = movy; + // rotate and mirror change direction of cooordinate system + var trafo = data.imgTrafo; + if (trafo != null) { + dx = (trafo.m00 > 0) ? movx : -movx; + dy = (trafo.m11 > 0) ? movy : -movy; + if (Math.abs(trafo.m00) < Math.abs(trafo.m01)) { + dx = (trafo.m01 > 0) ? -movy : movy; + dy = (trafo.m10 > 0) ? -movx : movx; + } + } var x2 = za.x + za.width; var y2 = za.y + za.height; - return (((movx < 0) && (za.x > 0)) - || ((movx > 0) && (x2 < 1.0)) - || ((movy < 0) && (za.y > 0)) - || ((movy > 0) && (y2 < 1.0))); + return (((dx < 0) && (za.x > 0)) || ((dx > 0) && (x2 < 1.0)) || ((dy < 0) && (za.y > 0)) || ((dy > 0) && (y2 < 1.0))); }; /** return if area is maximal.