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

View File

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

View File

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