diff webapp/src/main/webapp/jquery/jquery.digilib.geometry.js @ 1121:efe4b0f18cf8

annotator plugin does regions now.
author robcast
date Thu, 08 Nov 2012 18:42:57 +0100
parents 7affda55c10e
children fcafcc8996be
line wrap: on
line diff
--- a/webapp/src/main/webapp/jquery/jquery.digilib.geometry.js	Wed Nov 07 18:09:57 2012 +0100
+++ b/webapp/src/main/webapp/jquery/jquery.digilib.geometry.js	Thu Nov 08 18:42:57 2012 +0100
@@ -66,8 +66,8 @@
                 if (x.x != null) {
                     // position object
                     that = {
-                        x : x.x,
-                        y : x.y
+                        x : parseFloat(x.x),
+                        y : parseFloat(x.y)
                     };
                 }
                 if (x.pageX != null) {
@@ -156,10 +156,10 @@
             } else if (y == null) {
                 // assume x is rectangle
                 that = {
-                    x : x.x || 0,
-                    y : x.y || 0,
-                    width : x.width || 0,
-                    height : x.height || 0
+                    x : parseFloat(x.x) || 0,
+                    y : parseFloat(x.y) || 0,
+                    width : parseFloat(x.width) || 0,
+                    height : parseFloat(x.height) || 0
                 };
             } else {
                 // assume x and y are Position
@@ -346,6 +346,10 @@
         that.getAsSvg = function() {
             return [this.x, this.y, this.width, this.height].join(" ");
         };
+        // returns if this rectangle is a rectangle
+        that.isRectangle = function () {
+        	return this.width > 0 && this.height > 0;
+        };
         // returns size and position of this rectangle formatted for ??? (w x h@x,y)
         that.toString = function() {
             return this.width + "x" + this.height + "@" + this.x + "," + this.y;