-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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] Move Voronoi handler in a dedicated plugin #16470
Conversation
Deploy preview: https://deploy-preview-16470--material-ui-x.netlify.app/ Updated pages: |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
* @param scale The scale to use | ||
* @returns (value: any) => number | ||
*/ | ||
export function getValueToPositionMapper(scale: D3Scale) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extracted from the useScale.ts
export const selectorChartZoomIsInteracting = createSelector( | ||
selectorChartZoomState, | ||
(zoom) => zoom?.isInteracting, | ||
); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The selector got moved to the communit packeg to be able to stop voronoi computation during the zoom
CodSpeed Performance ReportMerging #16470 will not alter performanceComparing Summary
|
Tests are failing because of changes in this PR |
Nice it also helped me to realise I messed a bit with the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One test is still failing. I couldn't figure out why it is failing though. The code examples seem to behave correctly.
The remaining failing test came from the fact that when voronoi is enabled it should be the source of truth an so pointerEnter should not trigger interaction. Seems the behavior was buggy an fixed by this PR. Investigation let me also noticed one prop was not properly propagated. So I added a test on scatter chart such that the tooltip got test for both voronoi and item interacion |
fireEvent.pointerMove(svg, { | ||
clientX: 10, | ||
clientY: 10, | ||
}); // Set tooltip position voronoi value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Odd that this was necessary 🤔
I suppose it is because it is using fireEvent
instead of userEvent
, which would handle moving/hover/etc
Remove the Voronoi handler and make it aplugins.
In addition, we only compute the delauney graph when the zoom is not active