diff --git a/invokeai/frontend/web/src/features/nodes/components/ViewportControls.tsx b/invokeai/frontend/web/src/features/nodes/components/ViewportControls.tsx index 5f688722de..e2bcd3a0cc 100644 --- a/invokeai/frontend/web/src/features/nodes/components/ViewportControls.tsx +++ b/invokeai/frontend/web/src/features/nodes/components/ViewportControls.tsx @@ -2,9 +2,12 @@ import { ButtonGroup } from '@chakra-ui/react'; import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; import IAIIconButton from 'common/components/IAIIconButton'; import { memo, useCallback } from 'react'; -import { FaCode, FaExpand, FaMinus, FaPlus } from 'react-icons/fa'; +import { FaCode, FaExpand, FaMinus, FaPlus, FaInfo } from 'react-icons/fa'; import { useReactFlow } from 'reactflow'; -import { shouldShowGraphOverlayChanged } from '../store/nodesSlice'; +import { + shouldShowGraphOverlayChanged, + shouldShowFieldTypeLegendChanged, +} from '../store/nodesSlice'; const ViewportControls = () => { const { zoomIn, zoomOut, fitView } = useReactFlow(); @@ -12,6 +15,9 @@ const ViewportControls = () => { const shouldShowGraphOverlay = useAppSelector( (state) => state.nodes.shouldShowGraphOverlay ); + const shouldShowFieldTypeLegend = useAppSelector( + (state) => state.nodes.shouldShowFieldTypeLegend + ); const handleClickedZoomIn = useCallback(() => { zoomIn(); @@ -29,6 +35,10 @@ const ViewportControls = () => { dispatch(shouldShowGraphOverlayChanged(!shouldShowGraphOverlay)); }, [shouldShowGraphOverlay, dispatch]); + const handleClickedToggleFieldTypeLegend = useCallback(() => { + dispatch(shouldShowFieldTypeLegendChanged(!shouldShowFieldTypeLegend)); + }, [shouldShowFieldTypeLegend, dispatch]); + return ( { aria-label="Show/Hide Graph" icon={} /> + } + /> ); }; diff --git a/invokeai/frontend/web/src/features/nodes/components/panels/TopRightPanel.tsx b/invokeai/frontend/web/src/features/nodes/components/panels/TopRightPanel.tsx index 3fe8c49880..e3e3a871c8 100644 --- a/invokeai/frontend/web/src/features/nodes/components/panels/TopRightPanel.tsx +++ b/invokeai/frontend/web/src/features/nodes/components/panels/TopRightPanel.tsx @@ -9,10 +9,13 @@ const TopRightPanel = () => { const shouldShowGraphOverlay = useAppSelector( (state: RootState) => state.nodes.shouldShowGraphOverlay ); + const shouldShowFieldTypeLegend = useAppSelector( + (state: RootState) => state.nodes.shouldShowFieldTypeLegend + ); return ( - + {shouldShowFieldTypeLegend && } {shouldShowGraphOverlay && } ); diff --git a/invokeai/frontend/web/src/features/nodes/store/nodesSlice.ts b/invokeai/frontend/web/src/features/nodes/store/nodesSlice.ts index eac272ea01..6babcf6a86 100644 --- a/invokeai/frontend/web/src/features/nodes/store/nodesSlice.ts +++ b/invokeai/frontend/web/src/features/nodes/store/nodesSlice.ts @@ -32,6 +32,7 @@ export type NodesState = { invocationTemplates: Record; connectionStartParams: OnConnectStartParams | null; shouldShowGraphOverlay: boolean; + shouldShowFieldTypeLegend: boolean; editorInstance: ReactFlowInstance | undefined; }; @@ -42,6 +43,7 @@ export const initialNodesState: NodesState = { invocationTemplates: {}, connectionStartParams: null, shouldShowGraphOverlay: false, + shouldShowFieldTypeLegend: false, editorInstance: undefined, }; @@ -125,6 +127,12 @@ const nodesSlice = createSlice({ shouldShowGraphOverlayChanged: (state, action: PayloadAction) => { state.shouldShowGraphOverlay = action.payload; }, + shouldShowFieldTypeLegendChanged: ( + state, + action: PayloadAction + ) => { + state.shouldShowFieldTypeLegend = action.payload; + }, nodeTemplatesBuilt: ( state, action: PayloadAction> @@ -161,6 +169,7 @@ export const { connectionStarted, connectionEnded, shouldShowGraphOverlayChanged, + shouldShowFieldTypeLegendChanged, nodeTemplatesBuilt, nodeEditorReset, imageCollectionFieldValueChanged,