]> source.dussan.org Git - svg.js.git/commitdiff
node.getBBox() fallback. Fixes #21 22/head
authorRob Walch <rwalch@hugeinc.com>
Wed, 10 Apr 2013 22:47:59 +0000 (18:47 -0400)
committerRob Walch <rwalch@gmail.com>
Thu, 11 Apr 2013 01:42:59 +0000 (21:42 -0400)
src/bbox.js

index f58e77b46d21e00b69aaa19bf8e214c719fe680a..ee101b25f70af6d699bc18fd6f0c63222ff02d88 100644 (file)
@@ -1,7 +1,17 @@
 
 SVG.BBox = function(element) {
   /* actual, native bounding box */
-  var box = element.node.getBBox()
+  var box
+  try {
+    box = element.node.getBBox()
+  } catch(err) {
+    box = {
+      x: element.node.clientLeft,
+      y: element.node.clientTop,
+      width: element.node.clientWidth,
+      height: element.node.clientHeight
+    }
+  }
   
   /* include translations on x an y */
   this.x = box.x + element.trans.x