mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2024-12-29 09:22:22 -05:00
Improve translate() calls by directly calling Point objects and thus not relying on Point.read() internally.
This commit is contained in:
parent
27f291ec80
commit
f0d4374dc4
1 changed files with 4 additions and 8 deletions
|
@ -91,16 +91,14 @@ var Matrix = Base.extend({
|
|||
// Check arguments.length and typeof arguments[1], if object, assume
|
||||
// scale
|
||||
center = Point.read(arguments, 2);
|
||||
// TODO: Optimise calls to translate to not rely on point conversion
|
||||
// use private translate function instead.
|
||||
if (center)
|
||||
this.translate(center.x, center.y);
|
||||
this.translate(center);
|
||||
this._m00 *= sx;
|
||||
this._m10 *= sx;
|
||||
this._m01 *= sy;
|
||||
this._m11 *= sy;
|
||||
if (center)
|
||||
this.translate(-center.x, -center.y);
|
||||
this.translate(center.negate());
|
||||
return this;
|
||||
},
|
||||
|
||||
|
@ -145,10 +143,8 @@ var Matrix = Base.extend({
|
|||
*/
|
||||
shear: function(shx, shy, center) {
|
||||
center = Point.read(arguments, 2);
|
||||
// TODO: Optimise calls to translate to not rely on point conversion
|
||||
// use private translate function instead.
|
||||
if (center)
|
||||
this.translate(center.x, center.y);
|
||||
this.translate(center);
|
||||
var m00 = this._m00;
|
||||
var m10 = this._m10;
|
||||
this._m00 += shy * this._m01;
|
||||
|
@ -156,7 +152,7 @@ var Matrix = Base.extend({
|
|||
this._m01 += shx * m00;
|
||||
this._m11 += shx * m10;
|
||||
if (center)
|
||||
this.translate(-center.x, -center.y);
|
||||
this.translate(center.negate());
|
||||
return this;
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in a new issue