feat: add magic wand tool with settings and controls, including UI integration and functionality

This commit is contained in:
syntaxbullet
2026-07-04 11:49:35 +02:00
parent 6b6c2ebb80
commit af50a165da
19 changed files with 382 additions and 18 deletions

View File

@@ -13,6 +13,7 @@ import {
wheelInputEventFromWheelEvent,
} from "@input/index";
import { beginBrushSession, canPreviewBrush, commitBrushSession, updateBrushSession, type BrushSession } from "./brush";
import { applyMagicWandAt } from "./magic-wand";
export type CanvasInputOptions = {
globalKeybindConsumer: GlobalKeybindConsumer;
@@ -116,6 +117,12 @@ export function useCanvasInput(
return;
}
if (state.editor.tools.activeTool === "magicWand") {
void applyMagicWandAt(store, documentPoint, inputEvent.shiftKey ? "add" : inputEvent.altKey ? "subtract" : undefined);
event.preventDefault();
return;
}
const currentState = store.getState();
const selectionToolActive = currentState.editor.tools.activeTool === "select";
const selected = selectionToolActive && handleArtboardSelection({