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

[charts] Disable animations while zooming #13807

Merged
merged 4 commits into from
Jul 12, 2024

Conversation

JCQuintas
Copy link
Member

Remove the animations while zooming the chart.

@JCQuintas JCQuintas added enhancement This is not a bug, nor a new feature component: charts This is the name of the generic UI component, not the React module! labels Jul 11, 2024
@JCQuintas JCQuintas self-assigned this Jul 11, 2024
@mui-bot
Copy link

mui-bot commented Jul 11, 2024

Deploy preview: https://deploy-preview-13807--material-ui-x.netlify.app/

Generated by 🚫 dangerJS against 0b986f3

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Jul 11, 2024
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Jul 12, 2024
Comment on lines +97 to +99
interactionTimeoutRef.current = window.setTimeout(() => {
setIsInteracting(false);
}, 166);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is 166 a magic number? 🧙‍♂️

More seriously, what's the reason for this timeout?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It came from the mui/utils/debounce. It is 10 frames at 60hz apparently. We can probably remove it or make it smaller, since the timeout will run in a new cycle anyways. We just can't have setZoomData(newZoomData); and setIsInteracting(false); together because react bundles them up

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, this is a wheel event, so there is no "wheelup" for us to turn the toggle off. So we pretty much reset the timer if we have another wheel event and after a few ms we reset it to false again.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a comment

// Debounce transition to `isInteractive=false`.
// Useful for wheel events which doesn't have an end event

@JCQuintas JCQuintas enabled auto-merge (squash) July 12, 2024 12:34
@JCQuintas JCQuintas merged commit 6c67a09 into mui:master Jul 12, 2024
15 checks passed
@JCQuintas JCQuintas deleted the fix-zoom-animations branch July 12, 2024 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: charts This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants