Skip to content

Commit dabcc94

Browse files
committed
fix: remove animation before set effect
1 parent 3088ec9 commit dabcc94

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

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

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

306+
public removeAnimationByTargetKey(targetKey: string) {
307+
const index = this.stageAnimations.findIndex((e) => e.targetKey === targetKey);
308+
this.removeAnimationByIndex(index);
309+
}
310+
306311
public removeAnimationWithSetEffects(key: string) {
307312
const index = this.stageAnimations.findIndex((e) => e.key === key);
308313
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)