aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/frontend/src/graph/ZoomButtons.tsx
blob: 72f54774180a129fc7be99074ee7dc08dc89ba25 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
 * SPDX-FileCopyrightText: 2023 The Refinery Authors <https://refinery.tools/>
 *
 * SPDX-License-Identifier: EPL-2.0
 */

import AddIcon from '@mui/icons-material/Add';
import CropFreeIcon from '@mui/icons-material/CropFree';
import RemoveIcon from '@mui/icons-material/Remove';
import IconButton from '@mui/material/IconButton';
import Stack from '@mui/material/Stack';

export default function ZoomButtons({
  changeZoom,
  fitZoom,
}: {
  changeZoom: (event: React.MouseEvent, factor: number) => void;
  fitZoom: (event: React.MouseEvent) => void;
}): JSX.Element {
  return (
    <Stack
      direction="column"
      p={1}
      sx={{ position: 'absolute', bottom: 0, right: 0 }}
    >
      <IconButton
        aria-label="Zoom in"
        onClick={(event) => changeZoom(event, 2)}
      >
        <AddIcon fontSize="small" />
      </IconButton>
      <IconButton
        aria-label="Zoom out"
        onClick={(event) => changeZoom(event, 0.5)}
      >
        <RemoveIcon fontSize="small" />
      </IconButton>
      <IconButton aria-label="Fit screen" onClick={fitZoom}>
        <CropFreeIcon fontSize="small" />
      </IconButton>
    </Stack>
  );
}