aboutsummaryrefslogtreecommitdiffstats
path: root/src/bbox.js
diff options
context:
space:
mode:
authorwout <wout@impinc.co.uk>2013-02-20 19:10:03 +0100
committerwout <wout@impinc.co.uk>2013-02-20 19:10:03 +0100
commitae878fd63077d4c95f2de9053a6f0951b55239eb (patch)
tree5dba7bd42a8b5702faeb6cc12d2b4d4099841e51 /src/bbox.js
parent5020240e4029a61a9620f21d7be4d9764e7723d1 (diff)
downloadsvg.js-ae878fd63077d4c95f2de9053a6f0951b55239eb.tar.gz
svg.js-ae878fd63077d4c95f2de9053a6f0951b55239eb.zip
Created separate classes for SVG.ViewBox anSVG.BBox0.6
Diffstat (limited to 'src/bbox.js')
-rw-r--r--src/bbox.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/bbox.js b/src/bbox.js
new file mode 100644
index 0000000..d70ac68
--- /dev/null
+++ b/src/bbox.js
@@ -0,0 +1,18 @@
+
+SVG.BBox = function(element) {
+ /* actual, native bounding box */
+ var box = element.node.getBBox()
+
+ /* include translations on x an y */
+ this.x = box.x + element.trans.x
+ this.y = box.y + element.trans.y
+
+ /* add the center */
+ this.cx = box.x + element.trans.x + box.width / 2
+ this.cy = box.y + element.trans.y + box.height / 2
+
+ /* plain width and height */
+ this.width = box.width
+ this.height = box.height
+
+} \ No newline at end of file