Skip to content

Commit 97855db

Browse files
committed
ui-manchette-with-spacetimechart: add resetZoom callback
1 parent 874aebf commit 97855db

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

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

+5
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+
}, [yZoom]);
106+
103107
const handleScroll = useCallback(() => {
104108
if (!isShiftPressed && manchetteWithSpaceTimeChartContainer.current) {
105109
const { scrollTop } = manchetteWithSpaceTimeChartContainer.current;
@@ -146,6 +150,7 @@ const useManchettesWithSpaceTimeChart = (
146150
operationalPoints: operationalPointsWithHeight,
147151
zoomYIn,
148152
zoomYOut,
153+
resetZoom,
149154
toggleMode,
150155
yZoom,
151156
isProportional,

ui-manchette-with-spacetimechart/src/stories/base.stories.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,12 @@ const ManchetteWithSpaceTimeWrapper = ({
6969
);
7070
};
7171

72-
export default {
72+
const meta = {
7373
title: 'Manchette with SpaceTimeChart/rendering',
7474
component: ManchetteWithSpaceTimeWrapper,
75-
} as Meta<typeof ManchetteWithSpaceTimeWrapper>;
75+
} satisfies Meta<typeof ManchetteWithSpaceTimeWrapper>;
76+
77+
export default meta;
7678

7779
export const Default = {
7880
args: {

0 commit comments

Comments
 (0)