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",
|
"generalHotkeys": "General Hotkeys",
|
||||||
"galleryHotkeys": "Gallery Hotkeys",
|
"galleryHotkeys": "Gallery Hotkeys",
|
||||||
"unifiedCanvasHotkeys": "Unified Canvas Hotkeys",
|
"unifiedCanvasHotkeys": "Unified Canvas Hotkeys",
|
||||||
|
"nodesHotkeys": "Nodes Hotkeys",
|
||||||
"invoke": {
|
"invoke": {
|
||||||
"title": "Invoke",
|
"title": "Invoke",
|
||||||
"desc": "Generate an image"
|
"desc": "Generate an image"
|
||||||
@ -332,6 +333,10 @@
|
|||||||
"acceptStagingImage": {
|
"acceptStagingImage": {
|
||||||
"title": "Accept Staging Image",
|
"title": "Accept Staging Image",
|
||||||
"desc": "Accept Current Staging Area Image"
|
"desc": "Accept Current Staging Area Image"
|
||||||
|
},
|
||||||
|
"addNodes": {
|
||||||
|
"title": "Add Nodes",
|
||||||
|
"desc": "Opens the add node menu"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"modelManager": {
|
"modelManager": {
|
||||||
|
@ -2,6 +2,7 @@ import { useAppDispatch } from 'app/store/storeHooks';
|
|||||||
import IAIButton from 'common/components/IAIButton';
|
import IAIButton from 'common/components/IAIButton';
|
||||||
import { addNodePopoverOpened } from 'features/nodes/store/nodesSlice';
|
import { addNodePopoverOpened } from 'features/nodes/store/nodesSlice';
|
||||||
import { memo, useCallback } from 'react';
|
import { memo, useCallback } from 'react';
|
||||||
|
import { useHotkeys } from 'react-hotkeys-hook';
|
||||||
import { Panel } from 'reactflow';
|
import { Panel } from 'reactflow';
|
||||||
|
|
||||||
const TopLeftPanel = () => {
|
const TopLeftPanel = () => {
|
||||||
@ -11,6 +12,10 @@ const TopLeftPanel = () => {
|
|||||||
dispatch(addNodePopoverOpened());
|
dispatch(addNodePopoverOpened());
|
||||||
}, [dispatch]);
|
}, [dispatch]);
|
||||||
|
|
||||||
|
useHotkeys(['shift+a'], () => {
|
||||||
|
handleOpenAddNodePopover();
|
||||||
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Panel position="top-left">
|
<Panel position="top-left">
|
||||||
<IAIButton aria-label="Add Node" onClick={handleOpenAddNodePopover}>
|
<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[]) => (
|
const renderHotkeyModalItems = (hotkeys: HotkeyList[]) => (
|
||||||
<Flex flexDir="column" gap={4}>
|
<Flex flexDir="column" gap={4}>
|
||||||
{hotkeys.map((hotkey, i) => (
|
{hotkeys.map((hotkey, i) => (
|
||||||
@ -377,6 +385,22 @@ export default function HotkeysModal({ children }: HotkeysModalProps) {
|
|||||||
{renderHotkeyModalItems(unifiedCanvasHotkeys)}
|
{renderHotkeyModalItems(unifiedCanvasHotkeys)}
|
||||||
</AccordionPanel>
|
</AccordionPanel>
|
||||||
</AccordionItem>
|
</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>
|
</Flex>
|
||||||
</Accordion>
|
</Accordion>
|
||||||
</ModalBody>
|
</ModalBody>
|
||||||
|
Loading…
Reference in New Issue
Block a user