Skip to content

Commit 88637a7

Browse files
fix,feat: canvas followups 13 (#6893)
## Summary ### Fixes - Delete hotkey on gallery doesn't delete - Delete on workflows also triggers gallery delete - Brush/eraser width hotkeys not working ## Related Issues / Discussions discord & offline discussion ## QA Instructions Try the fixed things ## Merge Plan n/a ## Checklist - [x] _The PR has a short but descriptive title, suitable for a changelog_ - [ ] _Tests added / updated (if applicable)_ - [ ] _Documentation added / updated (if applicable)_
2 parents d622960 + bfba4b1 commit 88637a7

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

invokeai/frontend/web/src/features/controlLayers/components/Tool/ToolBrushWidth.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ export const ToolBrushWidth = memo(() => {
130130
}, [width]);
131131

132132
useRegisteredHotkeys({
133-
id: 'incrementToolWidth',
133+
id: 'decrementToolWidth',
134134
category: 'canvas',
135135
callback: decrement,
136136
options: { enabled: isSelected && !imageViewer.isOpen },

invokeai/frontend/web/src/features/controlLayers/components/Tool/ToolEraserWidth.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export const ToolEraserWidth = memo(() => {
133133
}, [width]);
134134

135135
useRegisteredHotkeys({
136-
id: 'incrementToolWidth',
136+
id: 'decrementToolWidth',
137137
category: 'canvas',
138138
callback: decrement,
139139
options: { enabled: isSelected && !imageViewer.isOpen },

invokeai/frontend/web/src/features/gallery/hooks/useGalleryHotkeys.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useStore } from '@nanostores/react';
22
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
3-
import { $activeScopes } from 'common/hooks/interactionScopes';
3+
import { $activeScopes, INTERACTION_SCOPES } from 'common/hooks/interactionScopes';
44
import { useAssertSingleton } from 'common/hooks/useAssertSingleton';
55
import { $canvasRightPanelTab } from 'features/controlLayers/store/ephemeral';
66
import { imagesToDeleteSelected } from 'features/deleteImageModal/store/slice';
@@ -38,6 +38,7 @@ export const useGalleryHotkeys = () => {
3838
const upDownHotkeysEnabled = useStore($upDownHotkeysEnabled);
3939
const canvasRightPanelTab = useStore($canvasRightPanelTab);
4040
const appTab = useAppSelector(selectActiveTab);
41+
const isWorkflowsScopeActive = useStore(INTERACTION_SCOPES.workflows.$isActive);
4142

4243
// When we are on the canvas tab, we need to disable the delete hotkey when the user is focused on the layers tab in
4344
// the right hand panel, because the same hotkey is used to delete layers.
@@ -212,7 +213,7 @@ export const useGalleryHotkeys = () => {
212213
}
213214
dispatch(imagesToDeleteSelected(selection));
214215
},
215-
options: { enabled: leftRightHotkeysEnabled && isDeleteEnabledByTab },
216-
dependencies: [leftRightHotkeysEnabled, isDeleteEnabledByTab],
216+
options: { enabled: leftRightHotkeysEnabled && isDeleteEnabledByTab && !isWorkflowsScopeActive },
217+
dependencies: [leftRightHotkeysEnabled, isDeleteEnabledByTab, selection, isWorkflowsScopeActive],
217218
});
218219
};

invokeai/frontend/web/src/features/nodes/components/flow/Flow.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useGlobalMenuClose, useToken } from '@invoke-ai/ui-library';
22
import { useStore } from '@nanostores/react';
33
import { useAppDispatch, useAppSelector, useAppStore } from 'app/store/storeHooks';
4-
import { INTERACTION_SCOPES, useScopeImperativeApi } from 'common/hooks/interactionScopes';
4+
import { INTERACTION_SCOPES, useScopeImperativeApi, useScopeOnFocus } from 'common/hooks/interactionScopes';
55
import { useConnection } from 'features/nodes/hooks/useConnection';
66
import { useCopyPaste } from 'features/nodes/hooks/useCopyPaste';
77
import { useSyncExecutionState } from 'features/nodes/hooks/useExecutionState';
@@ -91,6 +91,7 @@ export const Flow = memo(() => {
9191
const store = useAppStore();
9292
const isWorkflowsActive = useStore(INTERACTION_SCOPES.workflows.$isActive);
9393
const workflowsScopeApi = useScopeImperativeApi('workflows');
94+
useScopeOnFocus('workflows', flowWrapper);
9495

9596
useWorkflowWatcher();
9697
useSyncExecutionState();
@@ -318,7 +319,8 @@ export const Flow = memo(() => {
318319
id: 'deleteSelection',
319320
category: 'workflows',
320321
callback: deleteSelection,
321-
dependencies: [deleteSelection],
322+
options: { preventDefault: true, enabled: isWorkflowsActive },
323+
dependencies: [deleteSelection, isWorkflowsActive],
322324
});
323325

324326
return (

0 commit comments

Comments
 (0)