aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2015-11-18 14:38:33 +0100
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2015-11-18 14:38:33 +0100
commit30f7761e667607a696f91711f5c060002eb9edea (patch)
tree3e5ea9827151ed00068399e5590254cb6ee648d4 /src
parent22838c9da84b3a85d2ddb09a91a0ec690589b2fe (diff)
downloadsvg.js-30f7761e667607a696f91711f5c060002eb9edea.tar.gz
svg.js-30f7761e667607a696f91711f5c060002eb9edea.zip
added `gbox()` to group to get bbox with translation included (fixes #405)
Diffstat (limited to 'src')
-rw-r--r--src/group.js19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/group.js b/src/group.js
index 1b61371..df5c001 100644
--- a/src/group.js
+++ b/src/group.js
@@ -4,7 +4,7 @@ SVG.G = SVG.invent({
// Inherit from
, inherit: SVG.Container
-
+
// Add class methods
, extend: {
// Move over x-axis
@@ -23,8 +23,23 @@ SVG.G = SVG.invent({
, cy: function(y) {
return y == null ? this.tbox().cy : this.y(y - this.tbox().height / 2)
}
+ , gbox: function() {
+
+ var bbox = this.bbox()
+ , trans = this.transform()
+
+ bbox.x += trans.x
+ bbox.x2 += trans.x
+ bbox.cx += trans.x
+
+ bbox.y += trans.y
+ bbox.y2 += trans.y
+ bbox.cy += trans.y
+
+ return bbox
+ }
}
-
+
// Add parent method
, construct: {
// Create a group element