diff --git a/cocos/tiledmap/tiled-layer.ts b/cocos/tiledmap/tiled-layer.ts index 8ae73f65fd..eaba161599 100644 --- a/cocos/tiledmap/tiled-layer.ts +++ b/cocos/tiledmap/tiled-layer.ts @@ -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 () {