Remove crop tool

This commit is contained in:
syntaxbullet
2026-07-03 21:15:31 +02:00
parent 4ad0bb8b2c
commit 4590b47e19
11 changed files with 10 additions and 41 deletions

View File

@@ -39,25 +39,6 @@ describe("transform controls input", () => {
expect(dispatched).toEqual([]);
});
test("crop tool resizes from handles but does not move body", () => {
const state = createState({
selection: { artboardId: "a1", layerIds: [] },
tools: { activeTool: "crop", interactionMode: { type: "tool", tool: "crop" } },
});
const dispatched: unknown[] = [];
const controller = createTransformControlsInputController({
getDocument: () => state.document,
getEditor: () => state.editor,
dispatch: (commandId, payload) => {
dispatched.push({ commandId, payload });
return ignoredState;
},
});
expect(controller.pointerDown(pointerEvent({ position: { x: 100, y: 100 }, buttons: 1 }))).toBe(false);
expect(controller.pointerDown(pointerEvent({ position: { x: 150, y: 150 }, buttons: 1 }))).toBe(true);
});
test("dispatches transform lifecycle for selected artboard", () => {
let state = createState({ selection: { artboardId: "a1", layerIds: [] } });
const dispatched: unknown[] = [];

View File

@@ -16,7 +16,7 @@ import type { PointerInputEvent } from "./pointer";
type TransformHandle = "body" | "nw" | "n" | "ne" | "e" | "se" | "s" | "sw" | "w";
type InputToolId = "select" | "crop" | "brush" | "eraser" | "pan";
type InputToolId = "select" | "brush" | "eraser" | "pan";
type InputInteractionMode =
| { type: "tool"; tool: InputToolId }
@@ -48,8 +48,7 @@ export function createTransformControlsInputController(options: {
if (event.pointerType !== "mouse" || (event.buttons & 1) !== 1) return false;
const editor = options.getEditor();
const cropToolActive = editor.tools.activeTool === "crop";
if ((editor.tools.activeTool !== "select" && !cropToolActive) || isPanInteractionMode(editor.tools.interactionMode)) return false;
if (editor.tools.activeTool !== "select" || isPanInteractionMode(editor.tools.interactionMode)) return false;
const document = options.getDocument();
const target = selectedTransformTarget(document, editor.selection);
@@ -59,7 +58,7 @@ export function createTransformControlsInputController(options: {
if (!bounds) return false;
const handle = hitTestArtboardTransformHandle(event.position, bounds, editor.viewport);
if (!handle || (cropToolActive && handle === "body")) return false;
if (!handle) return false;
options.dispatch(commandIds.transformBegin, {
target,

View File

@@ -45,7 +45,7 @@ describe("viewport pan store integration", () => {
});
});
type InputToolId = "select" | "crop" | "brush" | "eraser" | "pan";
type InputToolId = "select" | "brush" | "eraser" | "pan";
type InputStore = ReturnType<typeof createInputStore>;