UNPKG

tldraw

Version:

A tiny little drawing editor.

36 lines (35 loc) 867 B
import { StateNode } from "@tldraw/editor"; class Pointing extends StateNode { static id = "pointing"; info = {}; onEnter(info) { this.info = info; } onPointerUp() { this.complete(); } onPointerMove() { if (this.editor.inputs.getIsDragging()) { this.parent.transition("zoom_brushing", this.info); } } onCancel() { this.cancel(); } complete() { const currentScreenPoint = this.editor.inputs.getCurrentScreenPoint(); if (this.editor.inputs.getAltKey()) { this.editor.zoomOut(currentScreenPoint, { animation: { duration: 220 } }); } else { this.editor.zoomIn(currentScreenPoint, { animation: { duration: 220 } }); } this.parent.transition("idle", this.info); } cancel() { this.parent.transition("idle", this.info); } } export { Pointing }; //# sourceMappingURL=Pointing.mjs.map