From: Rob Walch Date: Wed, 10 Apr 2013 22:47:59 +0000 (-0400) Subject: node.getBBox() fallback. Fixes #21 X-Git-Tag: 0.13~1^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F22%2Fhead;p=svg.js.git node.getBBox() fallback. Fixes #21 --- diff --git a/src/bbox.js b/src/bbox.js index f58e77b..ee101b2 100644 --- a/src/bbox.js +++ b/src/bbox.js @@ -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