From bfff3d6c4854c95f3aad80e9b113ca0c54539ee5 Mon Sep 17 00:00:00 2001 From: purpose Date: Sun, 26 Jan 2025 17:42:35 +0800 Subject: [PATCH 1/2] fix: fix the default param for animator stop --- packages/vgrammar-core/src/graph/animation/animate.ts | 4 ++-- packages/vgrammar-core/src/graph/animation/animator.ts | 2 +- packages/vgrammar-core/src/types/animate.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/vgrammar-core/src/graph/animation/animate.ts b/packages/vgrammar-core/src/graph/animation/animate.ts index d5d80ae7..bf51254c 100644 --- a/packages/vgrammar-core/src/graph/animation/animate.ts +++ b/packages/vgrammar-core/src/graph/animation/animate.ts @@ -119,7 +119,7 @@ export class Animate implements IAnimate { stopAnimationByState(animationState: string) { const animators = this.animators.get(animationState); if (animators) { - animators.forEach(animator => animator.stop()); + animators.forEach(animator => animator.stop('end')); } return this; } @@ -157,7 +157,7 @@ export class Animate implements IAnimate { stop() { // map will be cleared in animator callback this.animators.forEach(animators => { - animators.forEach(animator => animator.stop()); + animators.forEach(animator => animator.stop('end')); }); return this; } diff --git a/packages/vgrammar-core/src/graph/animation/animator.ts b/packages/vgrammar-core/src/graph/animation/animator.ts index 4d8aceb4..a174e170 100644 --- a/packages/vgrammar-core/src/graph/animation/animator.ts +++ b/packages/vgrammar-core/src/graph/animation/animator.ts @@ -73,7 +73,7 @@ export class Animator implements IAnimator { return this; } - stop(stopState?: 'start' | 'end', invokeCallback: boolean = true): this { + stop(stopState: 'start' | 'end' | null = 'end', invokeCallback: boolean = true): this { // FIXME: wait for VRender to fix 'end' parameter this.runnings.forEach(running => running.stop(stopState)); this.animationEnd(invokeCallback); diff --git a/packages/vgrammar-core/src/types/animate.ts b/packages/vgrammar-core/src/types/animate.ts index c28084b4..69e74064 100644 --- a/packages/vgrammar-core/src/types/animate.ts +++ b/packages/vgrammar-core/src/types/animate.ts @@ -275,7 +275,7 @@ export interface IAnimator { callback: (callbackFunction: (...args: any[]) => void) => this; // animation control - stop: (stopState?: 'start' | 'end', invokeCallback?: boolean) => this; + stop: (stopState: 'start' | 'end' | null, invokeCallback?: boolean) => this; pause: () => this; resume: () => this; From 0302479f7ce19945c074068abdae59952e78d7bc Mon Sep 17 00:00:00 2001 From: purpose Date: Sun, 26 Jan 2025 17:43:52 +0800 Subject: [PATCH 2/2] chore: update change log --- .../fix-default-stop-param_2025-01-26-09-43.json | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 common/changes/@visactor/vgrammar-core/fix-default-stop-param_2025-01-26-09-43.json diff --git a/common/changes/@visactor/vgrammar-core/fix-default-stop-param_2025-01-26-09-43.json b/common/changes/@visactor/vgrammar-core/fix-default-stop-param_2025-01-26-09-43.json new file mode 100644 index 00000000..08d05d9f --- /dev/null +++ b/common/changes/@visactor/vgrammar-core/fix-default-stop-param_2025-01-26-09-43.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vgrammar-core", + "comment": "fix: fix default param for animator stop", + "type": "none" + } + ], + "packageName": "@visactor/vgrammar-core" +} \ No newline at end of file