mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat: Add hotkey for Add Nodes (Shift+A)
Standard with other tools like Blender
This commit is contained in:
parent
01738deb23
commit
7b2079cf83
@ -133,6 +133,7 @@
|
||||
"generalHotkeys": "General Hotkeys",
|
||||
"galleryHotkeys": "Gallery Hotkeys",
|
||||
"unifiedCanvasHotkeys": "Unified Canvas Hotkeys",
|
||||
"nodesHotkeys": "Nodes Hotkeys",
|
||||
"invoke": {
|
||||
"title": "Invoke",
|
||||
"desc": "Generate an image"
|
||||
@ -332,6 +333,10 @@
|
||||
"acceptStagingImage": {
|
||||
"title": "Accept Staging Image",
|
||||
"desc": "Accept Current Staging Area Image"
|
||||
},
|
||||
"addNodes": {
|
||||
"title": "Add Nodes",
|
||||
"desc": "Opens the add node menu"
|
||||
}
|
||||
},
|
||||
"modelManager": {
|
||||
|
@ -2,6 +2,7 @@ import { useAppDispatch } from 'app/store/storeHooks';
|
||||
import IAIButton from 'common/components/IAIButton';
|
||||
import { addNodePopoverOpened } from 'features/nodes/store/nodesSlice';
|
||||
import { memo, useCallback } from 'react';
|
||||
import { useHotkeys } from 'react-hotkeys-hook';
|
||||
import { Panel } from 'reactflow';
|
||||
|
||||
const TopLeftPanel = () => {
|
||||
@ -11,6 +12,10 @@ const TopLeftPanel = () => {
|
||||
dispatch(addNodePopoverOpened());
|
||||
}, [dispatch]);
|
||||
|
||||
useHotkeys(['shift+a'], () => {
|
||||
handleOpenAddNodePopover();
|
||||
});
|
||||
|
||||
return (
|
||||
<Panel position="top-left">
|
||||
<IAIButton aria-label="Add Node" onClick={handleOpenAddNodePopover}>
|
||||
|
@ -286,6 +286,14 @@ export default function HotkeysModal({ children }: HotkeysModalProps) {
|
||||
},
|
||||
];
|
||||
|
||||
const nodesHotkeys = [
|
||||
{
|
||||
title: t('hotkeys.addNodes.title'),
|
||||
desc: t('hotkeys.addNodes.desc'),
|
||||
hotkey: 'Shift + A',
|
||||
},
|
||||
];
|
||||
|
||||
const renderHotkeyModalItems = (hotkeys: HotkeyList[]) => (
|
||||
<Flex flexDir="column" gap={4}>
|
||||
{hotkeys.map((hotkey, i) => (
|
||||
@ -377,6 +385,22 @@ export default function HotkeysModal({ children }: HotkeysModalProps) {
|
||||
{renderHotkeyModalItems(unifiedCanvasHotkeys)}
|
||||
</AccordionPanel>
|
||||
</AccordionItem>
|
||||
|
||||
<AccordionItem>
|
||||
<AccordionButton>
|
||||
<Flex
|
||||
width="100%"
|
||||
justifyContent="space-between"
|
||||
alignItems="center"
|
||||
>
|
||||
<h2>{t('hotkeys.nodesHotkeys')}</h2>
|
||||
<AccordionIcon />
|
||||
</Flex>
|
||||
</AccordionButton>
|
||||
<AccordionPanel>
|
||||
{renderHotkeyModalItems(nodesHotkeys)}
|
||||
</AccordionPanel>
|
||||
</AccordionItem>
|
||||
</Flex>
|
||||
</Accordion>
|
||||
</ModalBody>
|
||||
|
Loading…
Reference in New Issue
Block a user