Allow chaining of Item transform functions.

This commit is contained in:
Jürg Lehni 2011-03-06 11:42:08 +00:00
parent 5a1d31bba7
commit 0a690788ef

View file

@ -482,6 +482,7 @@ var Item = this.Item = Base.extend({
child.transform(matrix, flags); child.transform(matrix, flags);
} }
} }
return this;
}, },
/* /*
@ -514,7 +515,7 @@ var Item = this.Item = Base.extend({
translate: function(delta) { translate: function(delta) {
var mx = new Matrix(); var mx = new Matrix();
mx.translate.apply(mx, arguments); mx.translate.apply(mx, arguments);
this.transform(mx); return this.transform(mx);
}, },
/** /**
@ -535,7 +536,8 @@ var Item = this.Item = Base.extend({
center = sy; center = sy;
sy = sx; sy = sx;
} }
this.transform(new Matrix().scale(sx, sy, center || this.position)); return this.transform(new Matrix().scale(sx, sy,
center || this.position));
}, },
/** /**
@ -549,7 +551,8 @@ var Item = this.Item = Base.extend({
* @see Matrix#rotate(double, Point) * @see Matrix#rotate(double, Point)
*/ */
rotate: function(angle, center) { rotate: function(angle, center) {
this.transform(new Matrix().rotate(angle, center || this.position)); return this.transform(new Matrix().rotate(angle,
center || this.position));
}, },
/** /**
@ -566,7 +569,8 @@ var Item = this.Item = Base.extend({
center = shy; center = shy;
shy = shx; shy = shx;
} }
this.transform(new Matrix().shear(shx, shy, center || this.position)); return this.transform(new Matrix().shear(shx, shy,
center || this.position));
}, },
/** /**