From f6b77b744211986ad5115c00ed371986413297bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Tue, 14 Jun 2016 15:16:45 +0200 Subject: [PATCH] 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 --- src/item/Item.js | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/item/Item.js b/src/item/Item.js index ca880bd2..c97ceb51 100644 --- a/src/item/Item.js +++ b/src/item/Item.js @@ -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; } },