diff options
author | wout <wout@impinc.co.uk> | 2012-12-27 19:08:25 +0100 |
---|---|---|
committer | wout <wout@impinc.co.uk> | 2012-12-27 19:08:25 +0100 |
commit | 92628abe74749f8106ec271368c87df6b6f3c134 (patch) | |
tree | 1ae95b4f2ef1555d7ebfed618a6eff8125753226 /dist/svg.js | |
parent | 76af3112c3f3778eb0dfcbaf4517a7b46a3fb403 (diff) | |
download | svg.js-92628abe74749f8106ec271368c87df6b6f3c134.tar.gz svg.js-92628abe74749f8106ec271368c87df6b6f3c134.zip |
Bug fix in bbox()
Diffstat (limited to 'dist/svg.js')
-rw-r--r-- | dist/svg.js | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/dist/svg.js b/dist/svg.js index 749a9b8..f3e20ff 100644 --- a/dist/svg.js +++ b/dist/svg.js @@ -1,4 +1,4 @@ -/* svg.js v0.1-30-g9501ce9 - svg container element group arrange defs clip gradient doc shape rect circle ellipse path image text sugar - svgjs.com/license */ +/* svg.js v0.1-32-g76af311 - svg container element group arrange defs clip gradient doc shape rect circle ellipse path image text sugar - svgjs.com/license */ (function() { this.SVG = { @@ -173,6 +173,13 @@ return this.attr({ width: w, height: h }); }, + // position element by its center + center: function(x, y) { + var b = this.bbox(); + + return this.move(x - b.width / 2, y - b.height / 2); + }, + // remove element remove: function() { return this.parent != null ? this.parent.remove(this) : void 0; @@ -275,10 +282,10 @@ return { // include translations on x an y x: b.x + this.trans.x, - y: b.x + this.trans.y, + y: b.y + this.trans.y, // add the center cx: b.x + this.trans.x + b.width / 2, - cy: b.x + this.trans.y + b.height / 2, + cy: b.y + this.trans.y + b.height / 2, // plain width and height width: b.width, height: b.height |