Skip to content

Commit e66191b

Browse files
committed
ui-manchette-with-spacetimechart: add resetZoom callback
Signed-off-by: Clara Ni <[email protected]>
1 parent e51e660 commit e66191b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

ui-manchette-with-spacetimechart/src/hooks/useManchetteWithSpaceTimeChart.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ const useManchettesWithSpaceTimeChart = (
100100
}
101101
}, [yZoom]);
102102

103+
const resetZoom = useCallback(() => {
104+
setState((prev) => ({ ...prev, yZoom: 1 }));
105+
}, []);
106+
103107
const handleScroll = useCallback(() => {
104108
if (!isShiftPressed && manchetteWithSpaceTimeChartContainer.current) {
105109
const { scrollTop } = manchetteWithSpaceTimeChartContainer.current;
@@ -146,11 +150,12 @@ const useManchettesWithSpaceTimeChart = (
146150
operationalPoints: operationalPointsWithHeight,
147151
zoomYIn,
148152
zoomYOut,
153+
resetZoom,
149154
toggleMode,
150155
yZoom,
151156
isProportional,
152157
}),
153-
[operationalPointsWithHeight, zoomYIn, zoomYOut, toggleMode, yZoom, isProportional]
158+
[operationalPointsWithHeight, zoomYIn, zoomYOut, resetZoom, toggleMode, yZoom, isProportional]
154159
);
155160

156161
// Memoize spaceTimeChartProps separately

0 commit comments

Comments
 (0)