tldraw
Version:
A tiny little drawing editor.
36 lines (35 loc) • 837 B
JavaScript
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.isDragging) {
this.parent.transition("zoom_brushing", this.info);
}
}
onCancel() {
this.cancel();
}
complete() {
const { currentScreenPoint } = this.editor.inputs;
if (this.editor.inputs.altKey) {
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