mirror of
https://github.com/konvajs/konva.git
synced 2025-10-15 12:34:52 +08:00
Fix wrong internal caching of absolute attributes. fix #843
This commit is contained in:
@@ -123,13 +123,14 @@ export abstract class Container<ChildType extends Node> extends Node<
|
||||
}
|
||||
return this;
|
||||
}
|
||||
var child = arguments[0];
|
||||
var child = children[0];
|
||||
if (child.getParent()) {
|
||||
child.moveTo(this);
|
||||
return this;
|
||||
}
|
||||
var _children = this.children;
|
||||
this._validateAdd(child);
|
||||
child._clearCaches();
|
||||
child.index = _children.length;
|
||||
child.parent = this;
|
||||
_children.push(child);
|
||||
|
15
src/Node.ts
15
src/Node.ts
@@ -843,14 +843,19 @@ export abstract class Node<Config extends NodeConfig = NodeConfig> {
|
||||
this._remove();
|
||||
return this;
|
||||
}
|
||||
_clearCaches() {
|
||||
this._clearSelfAndDescendantCache(ABSOLUTE_TRANSFORM);
|
||||
this._clearSelfAndDescendantCache(ABSOLUTE_OPACITY);
|
||||
this._clearSelfAndDescendantCache(ABSOLUTE_SCALE);
|
||||
this._clearSelfAndDescendantCache(STAGE);
|
||||
this._clearSelfAndDescendantCache(VISIBLE);
|
||||
this._clearSelfAndDescendantCache(LISTENING);
|
||||
}
|
||||
_remove() {
|
||||
// every cached attr that is calculated via node tree
|
||||
// traversal must be cleared when removing a node
|
||||
this._clearSelfAndDescendantCache(STAGE);
|
||||
this._clearSelfAndDescendantCache(ABSOLUTE_TRANSFORM);
|
||||
this._clearSelfAndDescendantCache(VISIBLE);
|
||||
this._clearSelfAndDescendantCache(LISTENING);
|
||||
this._clearSelfAndDescendantCache(ABSOLUTE_OPACITY);
|
||||
this._clearCaches();
|
||||
|
||||
var parent = this.getParent();
|
||||
|
||||
if (parent && parent.children) {
|
||||
|
Reference in New Issue
Block a user