|
|
@ -2,11 +2,12 @@ import { isDarwin } from "../constants";
|
|
|
|
import { t } from "../i18n";
|
|
|
|
import { t } from "../i18n";
|
|
|
|
import { SubtypeOf } from "../utility-types";
|
|
|
|
import { SubtypeOf } from "../utility-types";
|
|
|
|
import { getShortcutKey } from "../utils";
|
|
|
|
import { getShortcutKey } from "../utils";
|
|
|
|
import { ActionName } from "./types";
|
|
|
|
import { ActionName, CustomActionName } from "./types";
|
|
|
|
|
|
|
|
|
|
|
|
export type ShortcutName =
|
|
|
|
export type ShortcutName =
|
|
|
|
| SubtypeOf<
|
|
|
|
| SubtypeOf<
|
|
|
|
ActionName,
|
|
|
|
ActionName,
|
|
|
|
|
|
|
|
| CustomActionName
|
|
|
|
| "toggleTheme"
|
|
|
|
| "toggleTheme"
|
|
|
|
| "loadScene"
|
|
|
|
| "loadScene"
|
|
|
|
| "clearCanvas"
|
|
|
|
| "clearCanvas"
|
|
|
@ -40,6 +41,15 @@ export type ShortcutName =
|
|
|
|
| "saveScene"
|
|
|
|
| "saveScene"
|
|
|
|
| "imageExport";
|
|
|
|
| "imageExport";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export const registerCustomShortcuts = (
|
|
|
|
|
|
|
|
shortcuts: Record<CustomActionName, string[]>,
|
|
|
|
|
|
|
|
) => {
|
|
|
|
|
|
|
|
for (const key in shortcuts) {
|
|
|
|
|
|
|
|
const shortcut = key as CustomActionName;
|
|
|
|
|
|
|
|
shortcutMap[shortcut] = shortcuts[shortcut];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const shortcutMap: Record<ShortcutName, string[]> = {
|
|
|
|
const shortcutMap: Record<ShortcutName, string[]> = {
|
|
|
|
toggleTheme: [getShortcutKey("Shift+Alt+D")],
|
|
|
|
toggleTheme: [getShortcutKey("Shift+Alt+D")],
|
|
|
|
saveScene: [getShortcutKey("CtrlOrCmd+S")],
|
|
|
|
saveScene: [getShortcutKey("CtrlOrCmd+S")],
|
|
|
|