feat(tools): add crop tool

This commit is contained in:
syntaxbullet
2026-07-03 17:32:46 +02:00
parent 5e4cde4df9
commit c946fb4c93
8 changed files with 48 additions and 8 deletions

View File

@@ -25,7 +25,8 @@ export function createTransformControlsInputController(options: {
if (event.pointerType !== "mouse" || (event.buttons & 1) !== 1) return false;
const editor = options.getEditor();
if (editor.tools.activeTool !== "select" || isPanInteractionMode(editor.tools.interactionMode)) return false;
const cropToolActive = editor.tools.activeTool === "crop";
if ((editor.tools.activeTool !== "select" && !cropToolActive) || isPanInteractionMode(editor.tools.interactionMode)) return false;
const document = options.getDocument();
const target = selectedTransformTarget(document, editor.selection);
@@ -35,7 +36,7 @@ export function createTransformControlsInputController(options: {
if (!bounds) return false;
const handle = hitTestArtboardTransformHandle(event.position, bounds, editor.viewport);
if (!handle) return false;
if (!handle || (cropToolActive && handle === "body")) return false;
options.dispatch(commandIds.transformBegin, {
target,