Introduce Matrix#setIdentity().

This commit is contained in:
Jürg Lehni 2011-12-20 23:14:30 +01:00
parent a8392fbf68
commit f2d7b85616
2 changed files with 7 additions and 5 deletions

View file

@ -66,8 +66,7 @@ var Matrix = this.Matrix = Base.extend(/** @lends Matrix# */{
ok = false;
}
} else if (count == 0) {
this._a = this._d = 1;
this._c = this._b = this._tx = this._ty = 0;
this.setIdentity();
} else {
ok = false;
}
@ -104,6 +103,11 @@ var Matrix = this.Matrix = Base.extend(/** @lends Matrix# */{
return this;
},
setIdentity: function() {
this._a = this._d = 1;
this._c = this._b = this._tx = this._ty = 0;
},
/**
* Concatentates this transform with a scaling transformation.
*

View file

@ -1861,9 +1861,7 @@ function(name) {
// access and code minification.
if (this._applyMatrix(this._matrix)) {
// Set _matrix to the identity
// TODO: Introduce Matrix#setIdentity() and use it from
// #initialize() too?
this._matrix.initialize();
this._matrix.setIdentity();
// TODO: This needs a _changed notification, but the GEOMETRY
// actually sdoesnt change! What to do?
}