Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/default stop param #624

Merged
merged 2 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading