Remove crop tool
This commit is contained in:
@@ -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[] = [];
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user