mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Disables canvas actions which cannot be done during processing
This commit is contained in:
parent
84f702b6d0
commit
c69573e65d
@ -31,18 +31,19 @@ import {
|
|||||||
isStagingSelector,
|
isStagingSelector,
|
||||||
} from 'features/canvas/store/canvasSelectors';
|
} from 'features/canvas/store/canvasSelectors';
|
||||||
import { useHotkeys } from 'react-hotkeys-hook';
|
import { useHotkeys } from 'react-hotkeys-hook';
|
||||||
import {
|
import { getCanvasBaseLayer } from 'features/canvas/util/konvaInstanceProvider';
|
||||||
getCanvasBaseLayer,
|
import { systemSelector } from 'features/system/systemSelectors';
|
||||||
getCanvasStage,
|
|
||||||
} from 'features/canvas/util/konvaInstanceProvider';
|
|
||||||
|
|
||||||
export const selector = createSelector(
|
export const selector = createSelector(
|
||||||
[canvasSelector, isStagingSelector],
|
[canvasSelector, isStagingSelector, systemSelector],
|
||||||
(canvas, isStaging) => {
|
(canvas, isStaging, system) => {
|
||||||
|
const { isProcessing } = system;
|
||||||
const { tool } = canvas;
|
const { tool } = canvas;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
tool,
|
tool,
|
||||||
isStaging,
|
isStaging,
|
||||||
|
isProcessing,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -54,7 +55,7 @@ export const selector = createSelector(
|
|||||||
|
|
||||||
const IAICanvasOutpaintingControls = () => {
|
const IAICanvasOutpaintingControls = () => {
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
const { tool, isStaging } = useAppSelector(selector);
|
const { tool, isStaging, isProcessing } = useAppSelector(selector);
|
||||||
const canvasBaseLayer = getCanvasBaseLayer();
|
const canvasBaseLayer = getCanvasBaseLayer();
|
||||||
|
|
||||||
useHotkeys(
|
useHotkeys(
|
||||||
@ -87,10 +88,10 @@ const IAICanvasOutpaintingControls = () => {
|
|||||||
handleMergeVisible();
|
handleMergeVisible();
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
enabled: () => true,
|
enabled: () => !isProcessing,
|
||||||
preventDefault: true,
|
preventDefault: true,
|
||||||
},
|
},
|
||||||
[canvasBaseLayer]
|
[canvasBaseLayer, isProcessing]
|
||||||
);
|
);
|
||||||
|
|
||||||
useHotkeys(
|
useHotkeys(
|
||||||
@ -99,10 +100,10 @@ const IAICanvasOutpaintingControls = () => {
|
|||||||
handleSaveToGallery();
|
handleSaveToGallery();
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
enabled: () => true,
|
enabled: () => !isProcessing,
|
||||||
preventDefault: true,
|
preventDefault: true,
|
||||||
},
|
},
|
||||||
[canvasBaseLayer]
|
[canvasBaseLayer, isProcessing]
|
||||||
);
|
);
|
||||||
|
|
||||||
useHotkeys(
|
useHotkeys(
|
||||||
@ -111,10 +112,10 @@ const IAICanvasOutpaintingControls = () => {
|
|||||||
handleCopyImageToClipboard();
|
handleCopyImageToClipboard();
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
enabled: () => true,
|
enabled: () => !isProcessing,
|
||||||
preventDefault: true,
|
preventDefault: true,
|
||||||
},
|
},
|
||||||
[canvasBaseLayer]
|
[canvasBaseLayer, isProcessing]
|
||||||
);
|
);
|
||||||
|
|
||||||
useHotkeys(
|
useHotkeys(
|
||||||
@ -123,10 +124,10 @@ const IAICanvasOutpaintingControls = () => {
|
|||||||
handleDownloadAsImage();
|
handleDownloadAsImage();
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
enabled: () => true,
|
enabled: () => !isProcessing,
|
||||||
preventDefault: true,
|
preventDefault: true,
|
||||||
},
|
},
|
||||||
[canvasBaseLayer]
|
[canvasBaseLayer, isProcessing]
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleSelectMoveTool = () => dispatch(setTool('move'));
|
const handleSelectMoveTool = () => dispatch(setTool('move'));
|
||||||
@ -200,24 +201,28 @@ const IAICanvasOutpaintingControls = () => {
|
|||||||
tooltip="Merge Visible (Shift + M)"
|
tooltip="Merge Visible (Shift + M)"
|
||||||
icon={<FaLayerGroup />}
|
icon={<FaLayerGroup />}
|
||||||
onClick={handleMergeVisible}
|
onClick={handleMergeVisible}
|
||||||
|
isDisabled={isProcessing}
|
||||||
/>
|
/>
|
||||||
<IAIIconButton
|
<IAIIconButton
|
||||||
aria-label="Save to Gallery (Shift + S)"
|
aria-label="Save to Gallery (Shift + S)"
|
||||||
tooltip="Save to Gallery (Shift + S)"
|
tooltip="Save to Gallery (Shift + S)"
|
||||||
icon={<FaSave />}
|
icon={<FaSave />}
|
||||||
onClick={handleSaveToGallery}
|
onClick={handleSaveToGallery}
|
||||||
|
isDisabled={isProcessing}
|
||||||
/>
|
/>
|
||||||
<IAIIconButton
|
<IAIIconButton
|
||||||
aria-label="Copy to Clipboard (Cmd/Ctrl + C)"
|
aria-label="Copy to Clipboard (Cmd/Ctrl + C)"
|
||||||
tooltip="Copy to Clipboard (Cmd/Ctrl + C)"
|
tooltip="Copy to Clipboard (Cmd/Ctrl + C)"
|
||||||
icon={<FaCopy />}
|
icon={<FaCopy />}
|
||||||
onClick={handleCopyImageToClipboard}
|
onClick={handleCopyImageToClipboard}
|
||||||
|
isDisabled={isProcessing}
|
||||||
/>
|
/>
|
||||||
<IAIIconButton
|
<IAIIconButton
|
||||||
aria-label="Download as Image (Shift + D)"
|
aria-label="Download as Image (Shift + D)"
|
||||||
tooltip="Download as Image (Shift + D)"
|
tooltip="Download as Image (Shift + D)"
|
||||||
icon={<FaDownload />}
|
icon={<FaDownload />}
|
||||||
onClick={handleDownloadAsImage}
|
onClick={handleDownloadAsImage}
|
||||||
|
isDisabled={isProcessing}
|
||||||
/>
|
/>
|
||||||
</ButtonGroup>
|
</ButtonGroup>
|
||||||
<ButtonGroup isAttached>
|
<ButtonGroup isAttached>
|
||||||
|
Loading…
Reference in New Issue
Block a user