import React from "react"; import { Menu, Flex, Input, Text } from "@mantine/core"; import { getHotkeyHandler, useHotkeys } from "@mantine/hooks"; import { CgChevronDown } from "react-icons/cg"; import useGraph from "src/store/useGraph"; import * as Styles from "./styles"; export const ZoomMenu = () => { const zoomIn = useGraph(state => state.zoomIn); const zoomOut = useGraph(state => state.zoomOut); const centerView = useGraph(state => state.centerView); const setZoomFactor = useGraph(state => state.setZoomFactor); const zoomFactor = useGraph(state => state.viewPort?.zoomFactor || 1); const [tempZoomValue, setTempZoomValue] = React.useState(zoomFactor); React.useEffect(() => { if (!Number.isNaN(zoomFactor)) setTempZoomValue(zoomFactor); }, [zoomFactor]); useHotkeys([ ["shift+Digit0", () => setZoomFactor(100 / 100)], ["shift+Digit1", centerView], ]); return (
); };