mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat(ui): Stylize Node Minimap
This commit is contained in:
parent
b73fd2a6d2
commit
b763f1809e
@ -1,6 +1,5 @@
|
|||||||
import {
|
import {
|
||||||
Background,
|
Background,
|
||||||
MiniMap,
|
|
||||||
OnConnect,
|
OnConnect,
|
||||||
OnEdgesChange,
|
OnEdgesChange,
|
||||||
OnNodesChange,
|
OnNodesChange,
|
||||||
@ -23,6 +22,7 @@ import TopLeftPanel from './panels/TopLeftPanel';
|
|||||||
import TopRightPanel from './panels/TopRightPanel';
|
import TopRightPanel from './panels/TopRightPanel';
|
||||||
import TopCenterPanel from './panels/TopCenterPanel';
|
import TopCenterPanel from './panels/TopCenterPanel';
|
||||||
import BottomLeftPanel from './panels/BottomLeftPanel.tsx';
|
import BottomLeftPanel from './panels/BottomLeftPanel.tsx';
|
||||||
|
import MinimapPanel from './panels/MinimapPanel';
|
||||||
|
|
||||||
const nodeTypes = { invocation: InvocationComponent };
|
const nodeTypes = { invocation: InvocationComponent };
|
||||||
|
|
||||||
@ -59,12 +59,9 @@ export const Flow = () => {
|
|||||||
[dispatch]
|
[dispatch]
|
||||||
);
|
);
|
||||||
|
|
||||||
const onConnectEnd: OnConnectEnd = useCallback(
|
const onConnectEnd: OnConnectEnd = useCallback(() => {
|
||||||
(event) => {
|
dispatch(connectionEnded());
|
||||||
dispatch(connectionEnded());
|
}, [dispatch]);
|
||||||
},
|
|
||||||
[dispatch]
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ReactFlow
|
<ReactFlow
|
||||||
@ -85,7 +82,7 @@ export const Flow = () => {
|
|||||||
<TopRightPanel />
|
<TopRightPanel />
|
||||||
<BottomLeftPanel />
|
<BottomLeftPanel />
|
||||||
<Background />
|
<Background />
|
||||||
<MiniMap nodeStrokeWidth={3} zoomable pannable />
|
<MinimapPanel />
|
||||||
</ReactFlow>
|
</ReactFlow>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -0,0 +1,34 @@
|
|||||||
|
import { RootState } from 'app/store';
|
||||||
|
import { useAppSelector } from 'app/storeHooks';
|
||||||
|
import { CSSProperties, memo } from 'react';
|
||||||
|
import { MiniMap } from 'reactflow';
|
||||||
|
|
||||||
|
const MinimapStyle: CSSProperties = {
|
||||||
|
background: 'var(--invokeai-colors-base-500)',
|
||||||
|
};
|
||||||
|
|
||||||
|
const MinimapPanel = () => {
|
||||||
|
const currentTheme = useAppSelector(
|
||||||
|
(state: RootState) => state.ui.currentTheme
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<MiniMap
|
||||||
|
nodeStrokeWidth={3}
|
||||||
|
pannable
|
||||||
|
zoomable
|
||||||
|
nodeBorderRadius={30}
|
||||||
|
style={MinimapStyle}
|
||||||
|
nodeColor={
|
||||||
|
currentTheme === 'light'
|
||||||
|
? 'var(--invokeai-colors-accent-700)'
|
||||||
|
: currentTheme === 'green'
|
||||||
|
? 'var(--invokeai-colors-accent-600)'
|
||||||
|
: 'var(--invokeai-colors-accent-700)'
|
||||||
|
}
|
||||||
|
maskColor="var(--invokeai-colors-base-700)"
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default memo(MinimapPanel);
|
Loading…
x
Reference in New Issue
Block a user