import { commandIds } from "@commands/ids"; import type { Dispatch } from "@commands/dispatcher"; import type { KeybindEvent } from "./keyboard"; const toolKeybinds = { b: "brush", e: "eraser", k: "chromaKey", w: "magicWand", p: "pan", s: "select", } as const; export function handleToolKey(options: { event: KeybindEvent; dispatch: Dispatch }): boolean { if (options.event.altKey || options.event.ctrlKey || options.event.metaKey) return false; const tool = toolKeybinds[options.event.key.toLowerCase() as keyof typeof toolKeybinds]; if (!tool) return false; options.dispatch(commandIds.toolSetActive, { tool }); return true; }