diff webapp/src/main/webapp/jquery/jquery.digilib.geometry.js @ 944:3916303b8f17

"preview" works now also for zoomIn/Out
author robcast
date Wed, 28 Dec 2011 22:04:18 +0100
parents 7779b37d1d05
children 3d5e7458f9ae
line wrap: on
line diff
--- a/webapp/src/main/webapp/jquery/jquery.digilib.geometry.js	Wed Dec 28 11:47:18 2011 +0100
+++ b/webapp/src/main/webapp/jquery/jquery.digilib.geometry.js	Wed Dec 28 22:04:18 2011 +0100
@@ -87,7 +87,7 @@
                 y : other.y - this.y
             });
         };
-        // adjusts position $elem to this position
+        // adjusts CSS position of $elem to this position
         that.adjustDiv = function($elem) {
             $elem.offset({
                 left : this.x,
@@ -210,11 +210,16 @@
             this.y = pos.y - this.height / 2;
             return this;
         };
-        // returns true if both rectangles have equal position and proportion
+        // returns true if both rectangles have equal position and size
         that.equals = function(other) {
             var eq = (this.x === other.x && this.y === other.y && this.width === other.width);
             return eq;
         };
+        // returns a rectangle with the difference width, height and position
+        that.delta = function(other) {
+            return rectangle(other.x - this.x, other.y - this.y, 
+            		other.width - this.width, other.height - this.height);
+        };
         // returns the area of this Rectangle
         that.getArea = function() {
             return (this.width * this.height);