TiledLayer should watch parent node position (#7857)

This commit is contained in:
江战
2020-11-24 17:14:28 +08:00
committed by GitHub
parent 04daf86633
commit b9c3b75d5f
+7 -1
View File
@@ -390,13 +390,19 @@ export class TiledLayer extends UIRenderable {
super.onEnable();
this.node.on(SystemEventType.ANCHOR_CHANGED, this._syncAnchorPoint, this);
this.node.on(SystemEventType.TRANSFORM_CHANGED, this.updateCulling, this);
this.node.on(SystemEventType.SIZE_CHANGED, this.updateCulling, this);
this.node.parent!.on(SystemEventType.TRANSFORM_CHANGED, this.updateCulling, this);
this.node.parent!.on(SystemEventType.SIZE_CHANGED, this.updateCulling, this);
this.markForUpdateRenderData();
}
onDisable () {
super.onDisable();
this.node.off(SystemEventType.ANCHOR_CHANGED, this._syncAnchorPoint, this);
this.node.parent!.off(SystemEventType.SIZE_CHANGED, this.updateCulling, this);
this.node.parent!.off(SystemEventType.TRANSFORM_CHANGED, this.updateCulling, this);
this.node.off(SystemEventType.SIZE_CHANGED, this.updateCulling, this);
this.node.off(SystemEventType.TRANSFORM_CHANGED, this.updateCulling, this);
this.node.off(SystemEventType.ANCHOR_CHANGED, this._syncAnchorPoint, this);
}
protected _syncAnchorPoint () {