diff options
Diffstat (limited to 'subprojects/frontend/src/graph/ZoomButtons.tsx')
-rw-r--r-- | subprojects/frontend/src/graph/ZoomButtons.tsx | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/subprojects/frontend/src/graph/ZoomButtons.tsx b/subprojects/frontend/src/graph/ZoomButtons.tsx index 72f54774..83938cf4 100644 --- a/subprojects/frontend/src/graph/ZoomButtons.tsx +++ b/subprojects/frontend/src/graph/ZoomButtons.tsx | |||
@@ -9,13 +9,18 @@ import CropFreeIcon from '@mui/icons-material/CropFree'; | |||
9 | import RemoveIcon from '@mui/icons-material/Remove'; | 9 | import RemoveIcon from '@mui/icons-material/Remove'; |
10 | import IconButton from '@mui/material/IconButton'; | 10 | import IconButton from '@mui/material/IconButton'; |
11 | import Stack from '@mui/material/Stack'; | 11 | import Stack from '@mui/material/Stack'; |
12 | import ToggleButton from '@mui/material/ToggleButton'; | ||
13 | |||
14 | import type { ChangeZoomCallback, SetFitZoomCallback } from './ZoomCanvas'; | ||
12 | 15 | ||
13 | export default function ZoomButtons({ | 16 | export default function ZoomButtons({ |
14 | changeZoom, | 17 | changeZoom, |
15 | fitZoom, | 18 | fitZoom, |
19 | setFitZoom, | ||
16 | }: { | 20 | }: { |
17 | changeZoom: (event: React.MouseEvent, factor: number) => void; | 21 | changeZoom: ChangeZoomCallback; |
18 | fitZoom: (event: React.MouseEvent) => void; | 22 | fitZoom: boolean; |
23 | setFitZoom: SetFitZoomCallback; | ||
19 | }): JSX.Element { | 24 | }): JSX.Element { |
20 | return ( | 25 | return ( |
21 | <Stack | 26 | <Stack |
@@ -23,21 +28,22 @@ export default function ZoomButtons({ | |||
23 | p={1} | 28 | p={1} |
24 | sx={{ position: 'absolute', bottom: 0, right: 0 }} | 29 | sx={{ position: 'absolute', bottom: 0, right: 0 }} |
25 | > | 30 | > |
26 | <IconButton | 31 | <IconButton aria-label="Zoom in" onClick={() => changeZoom(2)}> |
27 | aria-label="Zoom in" | ||
28 | onClick={(event) => changeZoom(event, 2)} | ||
29 | > | ||
30 | <AddIcon fontSize="small" /> | 32 | <AddIcon fontSize="small" /> |
31 | </IconButton> | 33 | </IconButton> |
32 | <IconButton | 34 | <IconButton aria-label="Zoom out" onClick={() => changeZoom(0.5)}> |
33 | aria-label="Zoom out" | ||
34 | onClick={(event) => changeZoom(event, 0.5)} | ||
35 | > | ||
36 | <RemoveIcon fontSize="small" /> | 35 | <RemoveIcon fontSize="small" /> |
37 | </IconButton> | 36 | </IconButton> |
38 | <IconButton aria-label="Fit screen" onClick={fitZoom}> | 37 | <ToggleButton |
38 | value="show-replace" | ||
39 | selected={fitZoom} | ||
40 | onClick={() => setFitZoom(!fitZoom)} | ||
41 | aria-label="Fit screen" | ||
42 | size="small" | ||
43 | className="iconOnly" | ||
44 | > | ||
39 | <CropFreeIcon fontSize="small" /> | 45 | <CropFreeIcon fontSize="small" /> |
40 | </IconButton> | 46 | </ToggleButton> |
41 | </Stack> | 47 | </Stack> |
42 | ); | 48 | ); |
43 | } | 49 | } |