Fixes bounding box hotkey conditions

This commit is contained in:
psychedelicious 2022-10-29 13:28:53 +11:00
parent 6a32adb7ed
commit 387f39407a
3 changed files with 8 additions and 3 deletions

View File

@ -27,6 +27,7 @@ import {
setNeedsRepaint, setNeedsRepaint,
toggleShouldLockBoundingBox, toggleShouldLockBoundingBox,
clearImageToInpaint, clearImageToInpaint,
setShouldShowBoundingBox,
} from './inpaintingSlice'; } from './inpaintingSlice';
import { MdInvertColors, MdInvertColorsOff } from 'react-icons/md'; import { MdInvertColors, MdInvertColorsOff } from 'react-icons/md';
@ -51,6 +52,7 @@ const InpaintingControls = () => {
isMaskEmpty, isMaskEmpty,
activeTabName, activeTabName,
showDualDisplay, showDualDisplay,
shouldShowBoundingBox
} = useAppSelector(inpaintingControlsSelector); } = useAppSelector(inpaintingControlsSelector);
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
@ -160,9 +162,9 @@ const InpaintingControls = () => {
dispatch(toggleShouldLockBoundingBox()); dispatch(toggleShouldLockBoundingBox());
}, },
{ {
enabled: activeTabName === 'inpainting' && shouldShowMask, enabled: activeTabName === 'inpainting' && shouldShowMask && shouldShowBoundingBox,
}, },
[activeTabName, shouldShowMask] [activeTabName, shouldShowMask, shouldShowBoundingBox]
); );
// Undo // Undo

View File

@ -88,6 +88,8 @@ const KeyboardEventManager = () => {
break; break;
} }
case ' ': { case ' ': {
if (!shouldShowMask) break;
if (e.type === 'keydown') { if (e.type === 'keydown') {
dispatch(setIsDrawing(false)); dispatch(setIsDrawing(false));
} }

View File

@ -31,6 +31,7 @@ export const inpaintingControlsSelector = createSelector(
pastLines, pastLines,
futureLines, futureLines,
shouldShowBoundingBoxFill, shouldShowBoundingBoxFill,
shouldShowBoundingBox,
} = inpainting; } = inpainting;
const { activeTab, showDualDisplay } = options; const { activeTab, showDualDisplay } = options;
@ -48,6 +49,7 @@ export const inpaintingControlsSelector = createSelector(
activeTabName: tabMap[activeTab], activeTabName: tabMap[activeTab],
showDualDisplay, showDualDisplay,
shouldShowBoundingBoxFill, shouldShowBoundingBoxFill,
shouldShowBoundingBox,
}; };
}, },
{ {
@ -73,7 +75,6 @@ export const inpaintingCanvasSelector = createSelector(
isDrawing, isDrawing,
shouldLockBoundingBox, shouldLockBoundingBox,
shouldShowBoundingBox, shouldShowBoundingBox,
} = inpainting; } = inpainting;
return { return {
tool, tool,