Remove recursive argument from Item#applyMatrix().

Always apply transforms recursively.
This commit is contained in:
Jürg Lehni 2011-12-19 21:20:10 +01:00
parent 12dbb11ec3
commit e89b2e5be1

View file

@ -1831,7 +1831,7 @@ function(name) {
if (this._transform) if (this._transform)
this._transform(matrix); this._transform(matrix);
if (apply) if (apply)
this.applyMatrix(false); this.applyMatrix();
// We always need to call _changed since we're caching bounds on all // We always need to call _changed since we're caching bounds on all
// items, including Group. // items, including Group.
this._changed(Change.GEOMETRY); this._changed(Change.GEOMETRY);
@ -1863,8 +1863,14 @@ function(name) {
return this; return this;
}, },
applyMatrix: function(recursive) { applyMatrix: function() {
if (this._applyMatrix(this._matrix, recursive)) { // Call the internal #_applyMatrix(), and set the internal _matrix to
// the identity transformation if it was possible to apply it.
// Application is not possible on Raster, PointText, PlacedSymbol, since
// the matrix is storing the actual location / transformation state.
// Pass on this._matrix to _applyMatrix calls, for reasons of faster
// access and code minification.
if (this._applyMatrix(this._matrix)) {
// Set _matrix to the identity // Set _matrix to the identity
// TODO: Introduce Matrix#setIdentity() and use it from // TODO: Introduce Matrix#setIdentity() and use it from
// #initialize() too? // #initialize() too?
@ -1874,13 +1880,13 @@ function(name) {
} }
}, },
_applyMatrix: function(matrix, recursive) { _applyMatrix: function(matrix) {
// Pass on the transformation to the children, and apply it there too:
if (this._children) { if (this._children) {
for (var i = 0, l = this._children.length; i < l; i++) { for (var i = 0, l = this._children.length; i < l; i++) {
var child = this._children[i]; var child = this._children[i];
child.transform(matrix); child.transform(matrix);
if (recursive) child.applyMatrix();
child.applyMatrix(true);
} }
return true; return true;
} }