From dabcc94641fab7fa729a0924ea707de6804b7e6d Mon Sep 17 00:00:00 2001 From: Hardy--Lee Date: Sat, 14 Mar 2026 13:06:35 +0800 Subject: [PATCH 1/2] fix: remove animation before set effect --- .../webgal/src/Core/controller/stage/pixi/PixiController.ts | 5 +++++ .../webgal/src/Core/util/syncWithEditor/webSocketFunc.ts | 1 + 2 files changed, 6 insertions(+) diff --git a/packages/webgal/src/Core/controller/stage/pixi/PixiController.ts b/packages/webgal/src/Core/controller/stage/pixi/PixiController.ts index e361db81f..8480efffd 100644 --- a/packages/webgal/src/Core/controller/stage/pixi/PixiController.ts +++ b/packages/webgal/src/Core/controller/stage/pixi/PixiController.ts @@ -303,6 +303,11 @@ export default class PixiStage { this.removeAnimationByIndex(index); } + public removeAnimationByTargetKey(targetKey: string) { + const index = this.stageAnimations.findIndex((e) => e.targetKey === targetKey); + this.removeAnimationByIndex(index); + } + public removeAnimationWithSetEffects(key: string) { const index = this.stageAnimations.findIndex((e) => e.key === key); if (index >= 0) { diff --git a/packages/webgal/src/Core/util/syncWithEditor/webSocketFunc.ts b/packages/webgal/src/Core/util/syncWithEditor/webSocketFunc.ts index 26a863ed3..6e9fb66f8 100644 --- a/packages/webgal/src/Core/util/syncWithEditor/webSocketFunc.ts +++ b/packages/webgal/src/Core/util/syncWithEditor/webSocketFunc.ts @@ -120,6 +120,7 @@ export const webSocketFunc = () => { ...(effect.transform?.scale ?? {}), }, }; + WebGAL.gameplay.pixiStage?.removeAnimationByTargetKey(effect.target); webgalStore.dispatch(stageActions.updateEffect({ target: effect.target, transform: newTransform })); } catch (e) { logger.error(`无法设置效果 ${message.message}, ${e}`); From f47ed3488157568eeb518a7398d60330137e3031 Mon Sep 17 00:00:00 2001 From: Mahiru Date: Sat, 21 Mar 2026 20:40:30 +0800 Subject: [PATCH 2/2] fix: update removeAnimationByTargetKey to handle multiple animations --- .../src/Core/controller/stage/pixi/PixiController.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/webgal/src/Core/controller/stage/pixi/PixiController.ts b/packages/webgal/src/Core/controller/stage/pixi/PixiController.ts index 8480efffd..9bf9333ab 100644 --- a/packages/webgal/src/Core/controller/stage/pixi/PixiController.ts +++ b/packages/webgal/src/Core/controller/stage/pixi/PixiController.ts @@ -304,8 +304,11 @@ export default class PixiStage { } public removeAnimationByTargetKey(targetKey: string) { - const index = this.stageAnimations.findIndex((e) => e.targetKey === targetKey); - this.removeAnimationByIndex(index); + let index = this.stageAnimations.findIndex((e) => e.targetKey === targetKey); + while (index !== -1) { + this.removeAnimationByIndex(index); + index = this.stageAnimations.findIndex((e) => e.targetKey === targetKey); + } } public removeAnimationWithSetEffects(key: string) {