added shortcut key, fixed regression impacting other tools
This commit is contained in:
parent
ca22a52102
commit
76795c7d1b
@ -480,6 +480,4 @@ export const actionToggleLaserPointer = register({
|
|||||||
},
|
},
|
||||||
checked: (appState) => appState.activeTool.type === "laser",
|
checked: (appState) => appState.activeTool.type === "laser",
|
||||||
contextItemLabel: "labels.laser",
|
contextItemLabel: "labels.laser",
|
||||||
keyTest: (event) =>
|
|
||||||
event.code === CODES.K && !event[KEYS.CTRL_OR_CMD] && !event.altKey,
|
|
||||||
});
|
});
|
||||||
|
@ -36,6 +36,7 @@ export type ShortcutName =
|
|||||||
| "flipVertical"
|
| "flipVertical"
|
||||||
| "hyperlink"
|
| "hyperlink"
|
||||||
| "toggleElementLock"
|
| "toggleElementLock"
|
||||||
|
| "toggleLaserPointerTool"
|
||||||
>
|
>
|
||||||
| "saveScene"
|
| "saveScene"
|
||||||
| "imageExport";
|
| "imageExport";
|
||||||
@ -83,6 +84,7 @@ const shortcutMap: Record<ShortcutName, string[]> = {
|
|||||||
viewMode: [getShortcutKey("Alt+R")],
|
viewMode: [getShortcutKey("Alt+R")],
|
||||||
hyperlink: [getShortcutKey("CtrlOrCmd+K")],
|
hyperlink: [getShortcutKey("CtrlOrCmd+K")],
|
||||||
toggleElementLock: [getShortcutKey("CtrlOrCmd+Shift+L")],
|
toggleElementLock: [getShortcutKey("CtrlOrCmd+Shift+L")],
|
||||||
|
toggleLaserPointerTool: [getShortcutKey("K")],
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getShortcutFromShortcutName = (name: ShortcutName) => {
|
export const getShortcutFromShortcutName = (name: ShortcutName) => {
|
||||||
|
@ -4620,7 +4620,7 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
|
|
||||||
lastPointerUp = onPointerUp;
|
lastPointerUp = onPointerUp;
|
||||||
|
|
||||||
if (this.state.activeTool.type === "laser") {
|
if (!this.state.viewModeEnabled || this.state.activeTool.type === "laser") {
|
||||||
window.addEventListener(EVENT.POINTER_MOVE, onPointerMove);
|
window.addEventListener(EVENT.POINTER_MOVE, onPointerMove);
|
||||||
window.addEventListener(EVENT.POINTER_UP, onPointerUp);
|
window.addEventListener(EVENT.POINTER_UP, onPointerUp);
|
||||||
window.addEventListener(EVENT.KEYDOWN, onKeyDown);
|
window.addEventListener(EVENT.KEYDOWN, onKeyDown);
|
||||||
|
@ -22,7 +22,6 @@ export const CODES = {
|
|||||||
Z: "KeyZ",
|
Z: "KeyZ",
|
||||||
R: "KeyR",
|
R: "KeyR",
|
||||||
S: "KeyS",
|
S: "KeyS",
|
||||||
K: "KeyK",
|
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export const KEYS = {
|
export const KEYS = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user