UNPKG

tldraw

Version:

A tiny little drawing editor.

37 lines (36 loc) 954 B
import { StateNode } from "@tldraw/editor"; import { selectOnCanvasPointerUp } from "../../selection-logic/selectOnCanvasPointerUp.mjs"; class PointingCanvas extends StateNode { static id = "pointing_canvas"; onEnter(info) { const additiveSelectionKey = info.shiftKey || info.accelKey; if (!additiveSelectionKey) { if (this.editor.getSelectedShapeIds().length > 0) { this.editor.markHistoryStoppingPoint("selecting none"); this.editor.selectNone(); } } } onPointerMove(info) { if (this.editor.inputs.getIsDragging()) { this.parent.transition("brushing", info); } } onPointerUp(info) { selectOnCanvasPointerUp(this.editor, info); this.complete(); } onComplete() { this.complete(); } onInterrupt() { this.parent.transition("idle"); } complete() { this.parent.transition("idle"); } } export { PointingCanvas }; //# sourceMappingURL=PointingCanvas.mjs.map