mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Update ViewportControls.tsx
This commit is contained in:
parent
990f34aa15
commit
11882173e3
@ -2,11 +2,19 @@ import { ButtonGroup } from '@chakra-ui/react';
|
|||||||
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
||||||
import IAIIconButton from 'common/components/IAIIconButton';
|
import IAIIconButton from 'common/components/IAIIconButton';
|
||||||
import { memo, useCallback } from 'react';
|
import { memo, useCallback } from 'react';
|
||||||
import { FaCode, FaExpand, FaMinus, FaPlus, FaInfo } from 'react-icons/fa';
|
import {
|
||||||
|
FaCode,
|
||||||
|
FaExpand,
|
||||||
|
FaMinus,
|
||||||
|
FaPlus,
|
||||||
|
FaInfo,
|
||||||
|
FaMapMarkerAlt,
|
||||||
|
} from 'react-icons/fa';
|
||||||
import { useReactFlow } from 'reactflow';
|
import { useReactFlow } from 'reactflow';
|
||||||
import {
|
import {
|
||||||
shouldShowGraphOverlayChanged,
|
shouldShowGraphOverlayChanged,
|
||||||
shouldShowFieldTypeLegendChanged,
|
shouldShowFieldTypeLegendChanged,
|
||||||
|
shouldShowMinimapPanelChanged,
|
||||||
} from '../store/nodesSlice';
|
} from '../store/nodesSlice';
|
||||||
|
|
||||||
const ViewportControls = () => {
|
const ViewportControls = () => {
|
||||||
@ -19,6 +27,10 @@ const ViewportControls = () => {
|
|||||||
(state) => state.nodes.shouldShowFieldTypeLegend
|
(state) => state.nodes.shouldShowFieldTypeLegend
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const shouldShowMinimapPanel = useAppSelector(
|
||||||
|
(state) => state.nodes.shouldShowMinimapPanel
|
||||||
|
);
|
||||||
|
|
||||||
const handleClickedZoomIn = useCallback(() => {
|
const handleClickedZoomIn = useCallback(() => {
|
||||||
zoomIn();
|
zoomIn();
|
||||||
}, [zoomIn]);
|
}, [zoomIn]);
|
||||||
@ -39,6 +51,10 @@ const ViewportControls = () => {
|
|||||||
dispatch(shouldShowFieldTypeLegendChanged(!shouldShowFieldTypeLegend));
|
dispatch(shouldShowFieldTypeLegendChanged(!shouldShowFieldTypeLegend));
|
||||||
}, [shouldShowFieldTypeLegend, dispatch]);
|
}, [shouldShowFieldTypeLegend, dispatch]);
|
||||||
|
|
||||||
|
const handleClickedToggleMiniMapPanel = useCallback(() => {
|
||||||
|
dispatch(shouldShowMinimapPanelChanged(!shouldShowMinimapPanel));
|
||||||
|
}, [shouldShowMinimapPanel, dispatch]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ButtonGroup isAttached orientation="vertical">
|
<ButtonGroup isAttached orientation="vertical">
|
||||||
<IAIIconButton
|
<IAIIconButton
|
||||||
@ -68,6 +84,12 @@ const ViewportControls = () => {
|
|||||||
aria-label="Show/Hide Field Type Legend"
|
aria-label="Show/Hide Field Type Legend"
|
||||||
icon={<FaInfo />}
|
icon={<FaInfo />}
|
||||||
/>
|
/>
|
||||||
|
<IAIIconButton
|
||||||
|
isChecked={shouldShowMinimapPanel}
|
||||||
|
onClick={handleClickedToggleMiniMapPanel}
|
||||||
|
aria-label="Show/Hide Minimap"
|
||||||
|
icon={<FaMapMarkerAlt />}
|
||||||
|
/>
|
||||||
</ButtonGroup>
|
</ButtonGroup>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user