feat: implement chroma key operation and related keybinds, update workspace panel management
This commit is contained in:
16
input/operation-keybinds.ts
Normal file
16
input/operation-keybinds.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { commandIds } from "@commands/ids";
|
||||
import type { Dispatch } from "@commands/dispatcher";
|
||||
import type { KeybindEvent } from "./keyboard";
|
||||
|
||||
const operationKeybinds = {
|
||||
g: "generate",
|
||||
k: "chromaKey",
|
||||
} as const;
|
||||
|
||||
export function handleOperationKey(options: { event: KeybindEvent; dispatch: Dispatch }): boolean {
|
||||
if (options.event.altKey || options.event.ctrlKey || options.event.metaKey) return false;
|
||||
const panel = operationKeybinds[options.event.key.toLowerCase() as keyof typeof operationKeybinds];
|
||||
if (!panel) return false;
|
||||
options.dispatch(commandIds.workspaceSetPanel, { panel });
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user