diff options
author | wout <wout@impinc.co.uk> | 2013-04-11 08:52:20 +0100 |
---|---|---|
committer | wout <wout@impinc.co.uk> | 2013-04-11 08:52:20 +0100 |
commit | ec833bcefe20bd51d128cd0978128a9c9a63a043 (patch) | |
tree | 2369300640e2bc4317bea0ca3b3849b3bb6b0871 /dist/svg.js | |
parent | 0ec7b9bf96cdd3ad2aa72682d3781c0aa1c7c356 (diff) | |
download | svg.js-ec833bcefe20bd51d128cd0978128a9c9a63a043.tar.gz svg.js-ec833bcefe20bd51d128cd0978128a9c9a63a043.zip |
Fix for Firefox in bbox()0.13
Diffstat (limited to 'dist/svg.js')
-rw-r--r-- | dist/svg.js | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/dist/svg.js b/dist/svg.js index 4aebf60..3b2f6e9 100644 --- a/dist/svg.js +++ b/dist/svg.js @@ -1,4 +1,4 @@ -/* svg.js v0.12-14-g6117eb4 - svg regex default color viewbox bbox element container fx event group arrange defs mask clip pattern gradient doc shape rect ellipse line poly path plotable image text nested sugar - svgjs.com/license */ +/* svg.js v0.12-20-g0ec7b9b - svg regex default color viewbox bbox element container fx event group arrange defs mask clip pattern gradient doc shape rect ellipse line poly path plotable image text nested sugar - svgjs.com/license */ ;(function() { this.SVG = function(element) { @@ -370,15 +370,26 @@ }) SVG.BBox = function(element) { + var box + /* actual, native bounding box */ - var box = element.node.getBBox() + try { + box = element.node.getBBox() + } catch(e) { + 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 this.y = box.y + element.trans.y /* plain width and height */ - this.width = box.width * element.trans.scaleX + this.width = box.width * element.trans.scaleX this.height = box.height * element.trans.scaleY /* add the center */ |