Hotkey Cleanup

- Viewer is now Z
- Canvas Move tool is V - sync with PS
- Removed some unused hotkeys
This commit is contained in:
blessedcoolant 2022-11-19 22:33:39 +13:00
parent e7f670a5b6
commit cde395e02f
5 changed files with 8 additions and 42 deletions

View File

@ -59,7 +59,7 @@ const IAICanvasOutpaintingControls = () => {
const canvasBaseLayer = getCanvasBaseLayer(); const canvasBaseLayer = getCanvasBaseLayer();
useHotkeys( useHotkeys(
['m'], ['v'],
() => { () => {
handleSelectMoveTool(); handleSelectMoveTool();
}, },
@ -193,8 +193,8 @@ const IAICanvasOutpaintingControls = () => {
<IAICanvasBrushButtonPopover /> <IAICanvasBrushButtonPopover />
<IAICanvasEraserButtonPopover /> <IAICanvasEraserButtonPopover />
<IAIIconButton <IAIIconButton
aria-label="Move (M)" aria-label="Move (V)"
tooltip="Move (M)" tooltip="Move (V)"
icon={<FaArrowsAlt />} icon={<FaArrowsAlt />}
data-selected={tool === 'move' || isStaging} data-selected={tool === 'move' || isStaging}
onClick={handleSelectMoveTool} onClick={handleSelectMoveTool}

View File

@ -5,7 +5,6 @@ import { activeTabNameSelector } from 'features/options/store/optionsSelectors';
import { import {
setShouldShowBoundingBox, setShouldShowBoundingBox,
setTool, setTool,
toggleShouldLockBoundingBox,
} from 'features/canvas/store/canvasSlice'; } from 'features/canvas/store/canvasSlice';
import { useAppDispatch, useAppSelector } from 'app/store'; import { useAppDispatch, useAppSelector } from 'app/store';
import { useRef } from 'react'; import { useRef } from 'react';
@ -47,18 +46,6 @@ const useInpaintingCanvasHotkeys = () => {
const canvasStage = getCanvasStage(); const canvasStage = getCanvasStage();
// Toggle lock bounding box
useHotkeys(
'shift+w',
() => {
dispatch(toggleShouldLockBoundingBox());
},
{
preventDefault: true,
},
[activeTabName]
);
useHotkeys( useHotkeys(
'shift+h', 'shift+h',
() => { () => {

View File

@ -52,7 +52,7 @@ export default function HotkeysModal({ children }: HotkeysModalProps) {
{ {
title: 'Toggle Viewer', title: 'Toggle Viewer',
desc: 'Open and close Image Viewer', desc: 'Open and close Image Viewer',
hotkey: 'V', hotkey: 'Z',
}, },
{ {
title: 'Toggle Gallery', title: 'Toggle Gallery',
@ -161,7 +161,7 @@ export default function HotkeysModal({ children }: HotkeysModalProps) {
{ {
title: 'Move Tool', title: 'Move Tool',
desc: 'Allows canvas navigation', desc: 'Allows canvas navigation',
hotkey: 'M', hotkey: 'V',
}, },
{ {
title: 'Quick Toggle Move', title: 'Quick Toggle Move',

View File

@ -94,13 +94,9 @@ export default function InvokeTabs() {
dispatch(setActiveTab(4)); dispatch(setActiveTab(4));
}); });
useHotkeys('6', () => {
dispatch(setActiveTab(5));
});
// Lightbox Hotkey // Lightbox Hotkey
useHotkeys( useHotkeys(
'v', 'z',
() => { () => {
dispatch(setIsLightBoxOpen(!isLightBoxOpen)); dispatch(setIsLightBoxOpen(!isLightBoxOpen));
}, },

View File

@ -1,7 +1,6 @@
import { Tooltip } from '@chakra-ui/react'; import { Tooltip } from '@chakra-ui/react';
import { createSelector } from '@reduxjs/toolkit'; import { createSelector } from '@reduxjs/toolkit';
import { ReactNode } from 'react'; import { ReactNode } from 'react';
import { useHotkeys } from 'react-hotkeys-hook';
import { VscSplitHorizontal } from 'react-icons/vsc'; import { VscSplitHorizontal } from 'react-icons/vsc';
import { RootState, useAppDispatch, useAppSelector } from 'app/store'; import { RootState, useAppDispatch, useAppSelector } from 'app/store';
import ImageGallery from 'features/gallery/components/ImageGallery'; import ImageGallery from 'features/gallery/components/ImageGallery';
@ -34,30 +33,14 @@ type InvokeWorkareaProps = {
const InvokeWorkarea = (props: InvokeWorkareaProps) => { const InvokeWorkarea = (props: InvokeWorkareaProps) => {
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
const { optionsPanel, children, styleClass } = props; const { optionsPanel, children, styleClass } = props;
const { const { showDualDisplay, isLightBoxOpen, shouldShowDualDisplayButton } =
showDualDisplay, useAppSelector(workareaSelector);
isLightBoxOpen,
shouldShowDualDisplayButton,
} = useAppSelector(workareaSelector);
const handleDualDisplay = () => { const handleDualDisplay = () => {
dispatch(setShowDualDisplay(!showDualDisplay)); dispatch(setShowDualDisplay(!showDualDisplay));
dispatch(setDoesCanvasNeedScaling(true)); dispatch(setDoesCanvasNeedScaling(true));
}; };
// Hotkeys
// Toggle split view
useHotkeys(
'shift+j',
() => {
handleDualDisplay();
},
{
enabled: shouldShowDualDisplayButton,
},
[showDualDisplay]
);
return ( return (
<div <div
className={ className={