Mercurial > hg > digilib-old
changeset 847:c662bf335881 jquery
fixed a bug in geom.intersect
author | hertzhaft |
---|---|
date | Sun, 06 Mar 2011 12:58:09 +0100 |
parents | dad6a171bc52 |
children | 77248c6d2a5f |
files | client/digitallibrary/jquery/jquery-test-embedded.html client/digitallibrary/jquery/jquery.digilib.geometry.js |
diffstat | 2 files changed, 13 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/client/digitallibrary/jquery/jquery-test-embedded.html Sat Mar 05 00:16:04 2011 +0100 +++ b/client/digitallibrary/jquery/jquery-test-embedded.html Sun Mar 06 12:58:09 2011 +0100 @@ -64,7 +64,7 @@ <script type="text/javascript"> $(document).ready(function(){ var opts = { - interactionMode : 'fullscreen', + interactionMode : 'embedded', scalerBaseUrl : 'http://digilib.biblhertz.it/digilib04/servlet/Scaler', showRegionNumbers : true, autoRegionLinks : false,
--- a/client/digitallibrary/jquery/jquery.digilib.geometry.js Sat Mar 05 00:16:04 2011 +0100 +++ b/client/digitallibrary/jquery/jquery.digilib.geometry.js Sun Mar 06 12:58:09 2011 +0100 @@ -262,24 +262,25 @@ }; // returns the intersection of rectangle "rect" and this one that.intersect = function(rect) { - var res = rect.clipTo(this); - if (res.width < 0 || res.height < 0) res = null; - return res; + var r = rect.copy(); + var result = r.clipTo(this); + if (result.width < 0 || result.height < 0) result = null; + return result; }; // returns a copy of rectangle "rect" that fits into this one // (moving it first) that.fit = function(rect) { - var sec = rect.copy(); - sec.x = Math.max(sec.x, this.x); - sec.y = Math.max(sec.y, this.x); - if (sec.x + sec.width > this.x + this.width) { - sec.x = this.x + this.width - sec.width; + var r = rect.copy(); + r.x = Math.max(r.x, this.x); + r.y = Math.max(r.y, this.x); + if (r.x + r.width > this.x + this.width) { + r.x = this.x + this.width - r.width; } - if (sec.y + sec.height > this.y + this.height) { - sec.y = this.y + this.height - sec.height; + if (r.y + r.height > this.y + this.height) { + r.y = this.y + this.height - r.height; } - return sec.intersect(this); + return r.intersect(this); }; // adjusts position and size of jQuery element "$elem" to this rectangle that.adjustDiv = function($elem) {