Updates hotkeys

This commit is contained in:
psychedelicious 2022-11-18 15:28:01 +11:00 committed by blessedcoolant
parent aa96a457b6
commit 07ca0876ec
2 changed files with 34 additions and 17 deletions

View File

@ -54,10 +54,39 @@ const IAICanvasMaskButtonPopover = () => {
[layer]
);
useHotkeys(
['shift+c'],
() => {
handleClearMask();
},
{
enabled: () => true,
preventDefault: true,
},
[]
);
useHotkeys(
['h'],
() => {
handleToggleEnableMask();
},
{
enabled: () => true,
preventDefault: true,
},
[isMaskEnabled]
);
const handleToggleMaskLayer = () => {
dispatch(setLayer(layer === 'mask' ? 'base' : 'mask'));
};
const handleClearMask = () => dispatch(clearMask());
const handleToggleEnableMask = () =>
dispatch(setIsMaskEnabled(!isMaskEnabled));
return (
<IAIPopover
trigger="hover"
@ -72,11 +101,11 @@ const IAICanvasMaskButtonPopover = () => {
}
>
<Flex direction={'column'} gap={'0.5rem'}>
<IAIButton onClick={() => dispatch(clearMask())}>Clear Mask</IAIButton>
<IAIButton onClick={handleClearMask}>Clear Mask</IAIButton>
<IAICheckbox
label="Enable Mask"
isChecked={isMaskEnabled}
onChange={(e) => dispatch(setIsMaskEnabled(e.target.checked))}
onChange={handleToggleEnableMask}
/>
<IAICheckbox
label="Preserve Masked Area"

View File

@ -69,7 +69,7 @@ const IAICanvasOutpaintingControls = () => {
);
useHotkeys(
['shift+r'],
['r'],
() => {
handleResetCanvasView();
},
@ -80,18 +80,6 @@ const IAICanvasOutpaintingControls = () => {
[canvasBaseLayer]
);
useHotkeys(
['shift+c'],
() => {
handleResetCanvas();
},
{
enabled: () => true,
preventDefault: true,
},
[canvasBaseLayer]
);
useHotkeys(
['shift+m'],
() => {
@ -241,8 +229,8 @@ const IAICanvasOutpaintingControls = () => {
icon={<FaUpload />}
/>
<IAIIconButton
aria-label="Reset Canvas View"
tooltip="Reset Canvas View"
aria-label="Reset Canvas View (R)"
tooltip="Reset Canvas View (R)"
icon={<FaCrosshairs />}
onClick={handleResetCanvasView}
/>