mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
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:
parent
2551027d17
commit
f6b77b7442
1 changed files with 3 additions and 12 deletions
|
@ -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;
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in a new issue