From a20c0b1430fb97ff203a9afd6ba6945cf18e58d1 Mon Sep 17 00:00:00 2001 From: wout Date: Fri, 28 Dec 2012 23:20:22 +0100 Subject: Added skew method to the sugar module --- src/element.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/element.js') diff --git a/src/element.js b/src/element.js index 5a4d4ed..e849867 100644 --- a/src/element.js +++ b/src/element.js @@ -110,20 +110,18 @@ SVG.extend(SVG.Element, { t.push('rotate(' + o.rotation + ',' + (o.cx != null ? o.cx : b.cx) + ',' + (o.cy != null ? o.cy : b.cy) + ')'); // add scale - if (o.scaleX != 1 && o.scaleY != 1) - t.push('scale(' + o.sx + ',' + o.sy + ')'); + t.push('scale(' + o.scaleX + ',' + o.scaleY + ')'); // add skew on x axis if (o.skewX != 0) - t.push('skewX(' + x.skewX + ')'); + t.push('skewX(' + o.skewX + ')'); // add skew on y axis if (o.skewY != 0) - t.push('skewY(' + x.skewY + ')') + t.push('skewY(' + o.skewY + ')') // add translate - if (o.x != 0 && o.y != 0) - t.push('translate(' + o.x + ',' + o.y + ')'); + t.push('translate(' + o.x + ',' + o.y + ')'); // add only te required transformations return this.attr('transform', t.join(' ')); @@ -138,9 +136,11 @@ SVG.extend(SVG.Element, { // include translations on x an y x: b.x + this.trans.x, y: b.y + this.trans.y, + // add the center - cx: b.x + this.trans.x + b.width / 2, + cx: b.x + this.trans.x + b.width / 2, cy: b.y + this.trans.y + b.height / 2, + // plain width and height width: b.width, height: b.height -- cgit v1.2.3