diff options
author | Wout Fierens <wout@impinc.co.uk> | 2013-04-10 23:59:01 -0700 |
---|---|---|
committer | Wout Fierens <wout@impinc.co.uk> | 2013-04-10 23:59:01 -0700 |
commit | 0ec7b9bf96cdd3ad2aa72682d3781c0aa1c7c356 (patch) | |
tree | a43ab5f0a0856e5640e8963d462d2a30105f6377 | |
parent | 582bd10836341ebfa752e7da92c6871fbc1f04fe (diff) | |
parent | ce1eb91fac1edc923b317caa83a3a4ab10e7c020 (diff) | |
download | svg.js-0ec7b9bf96cdd3ad2aa72682d3781c0aa1c7c356.tar.gz svg.js-0ec7b9bf96cdd3ad2aa72682d3781c0aa1c7c356.zip |
Merge pull request #22 from robwalch/master
node.getBBox() fallback
-rw-r--r-- | src/bbox.js | 12 |
1 files changed, 11 insertions, 1 deletions
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 |