mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-03-15 17:29:52 -04:00
Allow chaining of Item transform functions.
This commit is contained in:
parent
5a1d31bba7
commit
0a690788ef
1 changed files with 8 additions and 4 deletions
|
@ -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));
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue