Files
image-studio/input/tool-keybinds.ts
syntaxbullet 7188569672 feat: add ComfyUI integration for image generation
- Implemented ComfyUI API for generating images with various modes (text-to-image, image-to-image, inpaint, outpaint).
- Created GenerateSheet and associated controls for user input on generation settings.
- Added subtle scrollbar styles for improved UI experience.
- Enhanced canvas input handling to ignore key events when focused on editable elements.
- Optimized canvas resizing logic to prevent unnecessary dispatches.
- Introduced error handling for generation failures and loading models.
- Added functionality to upload images and masks for inpainting.
2026-07-04 15:10:30 +02:00

24 lines
672 B
TypeScript

import { commandIds } from "@commands/ids";
import type { Dispatch } from "@commands/dispatcher";
import type { KeybindEvent } from "./keyboard";
const toolKeybinds = {
g: "generate",
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;
}