Skip to content

Commit 1d8adcc

Browse files
committed
reset accumulated change on start rather than end
1 parent 5479548 commit 1d8adcc

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/x-charts-pro/src/internals/plugins/useChartProZoom/gestureHooks/usePanOnDrag.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ export const usePanOnDrag = (
5656
const handlePanStart = (event: PanEvent) => {
5757
if (!(event.detail.target as SVGElement)?.closest('[data-charts-zoom-slider]')) {
5858
isInteracting.current = true;
59+
accumulatedChange.current = { x: 0, y: 0 };
5960
}
6061
};
6162
const handlePanEnd = () => {
6263
isInteracting.current = false;
63-
accumulatedChange.current = { x: 0, y: 0 };
6464
};
6565

6666
const throttledCallback = rafThrottle(() => {

packages/x-charts-pro/src/internals/plugins/useChartProZoom/gestureHooks/usePanOnPressAndDrag.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ export const usePanOnPressAndDrag = (
5656
const handlePressAndDragStart = (event: PressAndDragEvent) => {
5757
if (!(event.detail.target as SVGElement)?.closest('[data-charts-zoom-slider]')) {
5858
isInteracting.current = true;
59+
accumulatedChange.current = { x: 0, y: 0 };
5960
}
6061
};
6162

6263
const handlePressAndDragEnd = () => {
6364
isInteracting.current = false;
64-
accumulatedChange.current = { x: 0, y: 0 };
6565
};
6666

6767
const throttledCallback = rafThrottle(() => {

0 commit comments

Comments
 (0)