Skip to content

Commit 1bebc83

Browse files
Merge pull request #899 from HardyNLee/fix/set-effect
fix: remove animation before set effect
2 parents c916f76 + f47ed34 commit 1bebc83

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

packages/webgal/src/Core/controller/stage/pixi/PixiController.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,14 @@ export default class PixiStage {
303303
this.removeAnimationByIndex(index);
304304
}
305305

306+
public removeAnimationByTargetKey(targetKey: string) {
307+
let index = this.stageAnimations.findIndex((e) => e.targetKey === targetKey);
308+
while (index !== -1) {
309+
this.removeAnimationByIndex(index);
310+
index = this.stageAnimations.findIndex((e) => e.targetKey === targetKey);
311+
}
312+
}
313+
306314
public removeAnimationWithSetEffects(key: string) {
307315
const index = this.stageAnimations.findIndex((e) => e.key === key);
308316
if (index >= 0) {

packages/webgal/src/Core/util/syncWithEditor/webSocketFunc.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ export const webSocketFunc = () => {
120120
...(effect.transform?.scale ?? {}),
121121
},
122122
};
123+
WebGAL.gameplay.pixiStage?.removeAnimationByTargetKey(effect.target);
123124
webgalStore.dispatch(stageActions.updateEffect({ target: effect.target, transform: newTransform }));
124125
} catch (e) {
125126
logger.error(`无法设置效果 ${message.message}, ${e}`);

0 commit comments

Comments
 (0)