Skip to content

Commit

Permalink
Merge pull request #624 from VisActor/fix/default-stop-param
Browse files Browse the repository at this point in the history
Fix/default stop param
  • Loading branch information
xile611 authored Feb 13, 2025
2 parents 9d53188 + 0302479 commit 4dced23
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@visactor/vgrammar-core",
"comment": "fix: fix default param for animator stop",
"type": "none"
}
],
"packageName": "@visactor/vgrammar-core"
}
4 changes: 2 additions & 2 deletions packages/vgrammar-core/src/graph/animation/animate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/vgrammar-core/src/graph/animation/animator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion packages/vgrammar-core/src/types/animate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 4dced23

Please sign in to comment.