mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-06 04:42:15 -05:00
Use faster Point.create().
This commit is contained in:
parent
a1ec8b7db1
commit
a21d180150
1 changed files with 3 additions and 2 deletions
|
@ -106,6 +106,7 @@ var Matrix = this.Matrix = Base.extend(/** @lends Matrix# */{
|
||||||
setIdentity: function() {
|
setIdentity: function() {
|
||||||
this._a = this._d = 1;
|
this._a = this._d = 1;
|
||||||
this._c = this._b = this._tx = this._ty = 0;
|
this._c = this._b = this._tx = this._ty = 0;
|
||||||
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -472,13 +473,13 @@ var Matrix = this.Matrix = Base.extend(/** @lends Matrix# */{
|
||||||
},
|
},
|
||||||
|
|
||||||
getTranslation: function() {
|
getTranslation: function() {
|
||||||
return new Point(this._tx, this._ty);
|
return Point.create(this._tx, this._ty);
|
||||||
},
|
},
|
||||||
|
|
||||||
getScaling: function() {
|
getScaling: function() {
|
||||||
var hor = Math.sqrt(this._a * this._a + this._c * this._c),
|
var hor = Math.sqrt(this._a * this._a + this._c * this._c),
|
||||||
ver = Math.sqrt(this._b * this._b + this._d * this._d);
|
ver = Math.sqrt(this._b * this._b + this._d * this._d);
|
||||||
return new Point(this._a < 0 ? -hor : hor, this._b < 0 ? -ver : ver);
|
return Point.create(this._a < 0 ? -hor : hor, this._b < 0 ? -ver : ver);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue