mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Node Editor: QoL Fixes (#3734)
- Make the viewport fit to view on Init - Update Reload Schema to an icon.
This commit is contained in:
commit
c1f2a9d56c
@ -674,5 +674,8 @@
|
|||||||
"showProgressImages": "Show Progress Images",
|
"showProgressImages": "Show Progress Images",
|
||||||
"hideProgressImages": "Hide Progress Images",
|
"hideProgressImages": "Hide Progress Images",
|
||||||
"swapSizes": "Swap Sizes"
|
"swapSizes": "Swap Sizes"
|
||||||
|
},
|
||||||
|
"nodes": {
|
||||||
|
"reloadSchema": "Reload Schema"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,10 @@ import {
|
|||||||
OnConnectEnd,
|
OnConnectEnd,
|
||||||
OnConnectStart,
|
OnConnectStart,
|
||||||
OnEdgesChange,
|
OnEdgesChange,
|
||||||
|
OnInit,
|
||||||
OnNodesChange,
|
OnNodesChange,
|
||||||
ReactFlow,
|
ReactFlow,
|
||||||
|
ReactFlowInstance,
|
||||||
} from 'reactflow';
|
} from 'reactflow';
|
||||||
import {
|
import {
|
||||||
connectionEnded,
|
connectionEnded,
|
||||||
@ -67,6 +69,12 @@ export const Flow = () => {
|
|||||||
dispatch(connectionEnded());
|
dispatch(connectionEnded());
|
||||||
}, [dispatch]);
|
}, [dispatch]);
|
||||||
|
|
||||||
|
const onInit: OnInit = useCallback((v: ReactFlowInstance) => {
|
||||||
|
if (v) {
|
||||||
|
v.fitView();
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ReactFlow
|
<ReactFlow
|
||||||
nodeTypes={nodeTypes}
|
nodeTypes={nodeTypes}
|
||||||
@ -77,6 +85,7 @@ export const Flow = () => {
|
|||||||
onConnectStart={onConnectStart}
|
onConnectStart={onConnectStart}
|
||||||
onConnect={onConnect}
|
onConnect={onConnect}
|
||||||
onConnectEnd={onConnectEnd}
|
onConnectEnd={onConnectEnd}
|
||||||
|
onInit={onInit}
|
||||||
defaultEdgeOptions={{
|
defaultEdgeOptions={{
|
||||||
style: { strokeWidth: 2 },
|
style: { strokeWidth: 2 },
|
||||||
}}
|
}}
|
||||||
|
@ -1,25 +1,18 @@
|
|||||||
import { HStack } from '@chakra-ui/react';
|
import { HStack } from '@chakra-ui/react';
|
||||||
import { useAppDispatch } from 'app/store/storeHooks';
|
import { memo } from 'react';
|
||||||
import IAIButton from 'common/components/IAIButton';
|
|
||||||
import { memo, useCallback } from 'react';
|
|
||||||
import { Panel } from 'reactflow';
|
import { Panel } from 'reactflow';
|
||||||
import { receivedOpenAPISchema } from 'services/api/thunks/schema';
|
|
||||||
import NodeInvokeButton from '../ui/NodeInvokeButton';
|
|
||||||
import CancelButton from 'features/parameters/components/ProcessButtons/CancelButton';
|
import CancelButton from 'features/parameters/components/ProcessButtons/CancelButton';
|
||||||
|
import NodeInvokeButton from '../ui/NodeInvokeButton';
|
||||||
|
import ReloadSchemaButton from '../ui/ReloadSchemaButton';
|
||||||
|
|
||||||
const TopCenterPanel = () => {
|
const TopCenterPanel = () => {
|
||||||
const dispatch = useAppDispatch();
|
|
||||||
|
|
||||||
const handleReloadSchema = useCallback(() => {
|
|
||||||
dispatch(receivedOpenAPISchema());
|
|
||||||
}, [dispatch]);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Panel position="top-center">
|
<Panel position="top-center">
|
||||||
<HStack>
|
<HStack>
|
||||||
<NodeInvokeButton />
|
<NodeInvokeButton />
|
||||||
<CancelButton />
|
<CancelButton />
|
||||||
<IAIButton onClick={handleReloadSchema}>Reload Schema</IAIButton>
|
<ReloadSchemaButton />
|
||||||
</HStack>
|
</HStack>
|
||||||
</Panel>
|
</Panel>
|
||||||
);
|
);
|
||||||
|
@ -0,0 +1,24 @@
|
|||||||
|
import { useAppDispatch } from 'app/store/storeHooks';
|
||||||
|
import IAIIconButton from 'common/components/IAIIconButton';
|
||||||
|
import { useCallback } from 'react';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import { FaSyncAlt } from 'react-icons/fa';
|
||||||
|
import { receivedOpenAPISchema } from 'services/api/thunks/schema';
|
||||||
|
|
||||||
|
export default function ReloadSchemaButton() {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const dispatch = useAppDispatch();
|
||||||
|
|
||||||
|
const handleReloadSchema = useCallback(() => {
|
||||||
|
dispatch(receivedOpenAPISchema());
|
||||||
|
}, [dispatch]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<IAIIconButton
|
||||||
|
icon={<FaSyncAlt />}
|
||||||
|
tooltip={t('nodes.reloadSchema')}
|
||||||
|
aria-label={t('nodes.reloadSchema')}
|
||||||
|
onClick={handleReloadSchema}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user