mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-07-29 07:09:45 -04:00
Remove all create() constructors for basic types since new constructors are now faster.
Woop!
This commit is contained in:
parent
0f74c01f75
commit
cd7db56249
18 changed files with 74 additions and 110 deletions
src/basic
|
@ -99,7 +99,7 @@ var Matrix = Base.extend(/** @lends Matrix# */{
|
|||
* @return {Matrix} A copy of this transform.
|
||||
*/
|
||||
clone: function() {
|
||||
return Matrix.create(this._a, this._c, this._b, this._d,
|
||||
return new Matrix(this._a, this._c, this._b, this._d,
|
||||
this._tx, this._ty);
|
||||
},
|
||||
|
||||
|
@ -516,7 +516,7 @@ var Matrix = Base.extend(/** @lends Matrix# */{
|
|||
|
||||
return {
|
||||
translation: this.getTranslation(),
|
||||
scaling: Point.create(scaleX, scaleY),
|
||||
scaling: new Point(scaleX, scaleY),
|
||||
rotation: -Math.atan2(b, a) * 180 / Math.PI,
|
||||
shearing: shear
|
||||
};
|
||||
|
@ -583,7 +583,7 @@ var Matrix = Base.extend(/** @lends Matrix# */{
|
|||
*/
|
||||
getTranslation: function() {
|
||||
// No decomposition is required to extract translation, so treat this
|
||||
return Point.create(this._tx, this._ty);
|
||||
return new Point(this._tx, this._ty);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -618,7 +618,7 @@ var Matrix = Base.extend(/** @lends Matrix# */{
|
|||
*/
|
||||
inverted: function() {
|
||||
var det = this._getDeterminant();
|
||||
return det && Matrix.create(
|
||||
return det && new Matrix(
|
||||
this._d / det,
|
||||
-this._c / det,
|
||||
-this._b / det,
|
||||
|
@ -628,7 +628,7 @@ var Matrix = Base.extend(/** @lends Matrix# */{
|
|||
},
|
||||
|
||||
shiftless: function() {
|
||||
return Matrix.create(this._a, this._c, this._b, this._d, 0, 0);
|
||||
return new Matrix(this._a, this._c, this._b, this._d, 0, 0);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -638,13 +638,6 @@ var Matrix = Base.extend(/** @lends Matrix# */{
|
|||
*/
|
||||
applyToContext: function(ctx) {
|
||||
ctx.transform(this._a, this._c, this._b, this._d, this._tx, this._ty);
|
||||
},
|
||||
|
||||
statics: /** @lends Matrix */{
|
||||
// See Point.create()
|
||||
create: function(a, c, b, d, tx, ty) {
|
||||
return Base.create(Matrix).set(a, c, b, d, tx, ty);
|
||||
}
|
||||
}
|
||||
}, new function() {
|
||||
return Base.each({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue