diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/group.js | 16 | ||||
-rw-r--r-- | src/sugar.js | 12 |
2 files changed, 14 insertions, 14 deletions
diff --git a/src/group.js b/src/group.js index f0d3d8b..dc2b60b 100644 --- a/src/group.js +++ b/src/group.js @@ -9,11 +9,11 @@ SVG.G = SVG.invent({ extend: { // Move over x-axis x: function (x) { - return x == null ? this.transform('x') : this.transform({ x: x - this.x() }, true) + return x == null ? this.transform().e : this.translate(x - this.gbox().x, 0) }, // Move over y-axis y: function (y) { - return y == null ? this.transform('y') : this.transform({ y: y - this.y() }, true) + return y == null ? this.transform().f : this.translate(0, y - this.gbox().y) }, // Move by center over x-axis cx: function (x) { @@ -27,13 +27,13 @@ SVG.G = SVG.invent({ var bbox = this.bbox() var trans = this.transform() - bbox.x += trans.x - bbox.x2 += trans.x - bbox.cx += trans.x + bbox.x += trans.e + bbox.x2 += trans.e + bbox.cx += trans.e - bbox.y += trans.y - bbox.y2 += trans.y - bbox.cy += trans.y + bbox.y += trans.f + bbox.y2 += trans.f + bbox.cy += trans.f return bbox } diff --git a/src/sugar.js b/src/sugar.js index 54cc289..6f81898 100644 --- a/src/sugar.js +++ b/src/sugar.js @@ -36,21 +36,21 @@ var sugar = { SVG.extend([SVG.Element, SVG.FX], { // Map rotation to transform rotate: function (angle, cx, cy) { - return this.transform({rotate: angle, ox: cx, oy: cy}, true) + return this.transform({rotate: angle, origin: [cx, cy]}, true) }, // Map skew to transform skew: function (x, y, cx, cy) { return arguments.length === 1 || arguments.length === 3 - ? this.transform({skew: x, ox: y, oy: cx}, true) - : this.transform({skew: [x, y], ox: cx, oy: cy}, true) + ? this.transform({skew: x, origin: [y, cx]}, true) + : this.transform({skew: [x, y], origin: [cx, cy]}, true) }, // Map scale to transform scale: function (x, y, cx, cy) { return arguments.length === 1 || arguments.length === 3 ? this.transform({ scale: x, origin: [y, cx] }, true) - : this.transform({ scaleX: x, scaleY: y, origin: [cx, cy] }, true) + : this.transform({ scale: [x, y], origin: [cx, cy] }, true) }, // Map translate to transform @@ -63,8 +63,8 @@ SVG.extend([SVG.Element, SVG.FX], { var origin = (direction === "both" && isFinite(around)) ? [around, around] : (direction === "x") ? [around, 0] : (direction === "y") ? [0, around] - : undefined - this.transform({flip: direction, origin: origin}) + : [0, 0] + this.transform({flip: direction || "both", origin: origin}, true) }, // Opacity |