Do not change cashed decomposed matrix data when transforming content.

Just clear the cache and force new decomposition on next use, to avoid issues with nested applied transforms.

Closes #1004
This commit is contained in:
Jürg Lehni 2016-06-14 15:16:45 +02:00
parent 2551027d17
commit f6b77b7442

View file

@ -1077,12 +1077,7 @@ new function() { // Injection scope for various item event handlers
setRotation: function(rotation) {
var current = this.getRotation();
if (current != null && rotation != null) {
// Preserve the cached _decomposed values over rotation, and only
// update the rotation property on it.
var decomposed = this._decomposed;
this.rotate(rotation - current);
decomposed.rotation = rotation;
this._decomposed = decomposed;
}
},
@ -1101,15 +1096,11 @@ new function() { // Injection scope for various item event handlers
},
setScaling: function(/* scaling */) {
var current = this.getScaling();
if (current) {
var current = this.getScaling(),
// Clone existing points since we're caching internally.
var scaling = Point.read(arguments, 0, { clone: true }),
// See #setRotation() for preservation of _decomposed.
decomposed = this._decomposed;
scaling = Point.read(arguments, 0, { clone: true, readNull: true })
if (current && scaling) {
this.scale(scaling.x / current.x, scaling.y / current.y);
decomposed.scaling = scaling;
this._decomposed = decomposed;
}
},