UNPKG

@tldraw/editor

Version:

A tiny little drawing app (editor).

28 lines (27 loc) 612 B
import { Vec } from "../Vec.mjs"; import { Geometry2d } from "./Geometry2d.mjs"; class Point2d extends Geometry2d { point; constructor(config) { super({ ...config, isClosed: true, isFilled: true }); const { point } = config; this.point = point; } getVertices() { return [this.point]; } nearestPoint() { return this.point; } hitTestLineSegment(A, B, margin) { return Vec.DistanceToLineSegment(A, B, this.point) < margin; } getSvgPathData() { const { point } = this; return `M${point.toFixed()}`; } } export { Point2d }; //# sourceMappingURL=Point2d.mjs.map