fix detach bug on destroy

This commit is contained in:
Anton Lavrenov
2020-04-23 11:33:00 -05:00
parent f58635bbf6
commit b657111578
4 changed files with 1373 additions and 59 deletions

View File

@@ -463,9 +463,11 @@ export class Transformer extends Group {
*/
detach() {
// remove events
this._nodes.forEach(node => {
node.off('.' + EVENTS_NAME);
});
if (this._nodes) {
this._nodes.forEach(node => {
node.off('.' + EVENTS_NAME);
});
}
this._nodes = [];
this._resetTransformCache();
}
@@ -1004,6 +1006,13 @@ export class Transformer extends Group {
return;
}
}
// let's find delta transform
// var dx = newAttrs.x - oldAttrs.x,
// dy = newAttrs.y - oldAttrs.y,
// angle = newAttrs.rotation - oldAttrs.rotation,
// scaleX = newAttrs.width / oldAttrs.width,
// scaleY = newAttrs.height / oldAttrs.height;
this._nodes.forEach(node => {
var oldRect = this.__getNodeShape(node, 0);
var newRect = transformAndRotateShape(oldRect, oldAttrs, newAttrs);