@remotedraw/geometry
v0.2.0
Published
Normalized stroke geometry, shape assist, hit testing, and export helpers for RemoteDraw.
Maintainers
Readme
@remotedraw/geometry
Normalized stroke geometry, shape assist, hit testing, transforms, and export
helpers for RemoteDraw drawings. Framework-free and has no dependency on
@remotedraw/client, @remotedraw/protocol, or any UI library — pure
geometry math over RemoteDraw's 0..1 normalized stroke coordinates.
What it provides:
buildNormalizedStroke/recognizeStroke/snapNormalizedStrokeEndpoints— shape assist: turning raw pointer input into normalized strokes and recognizing lines, rectangles, ellipses, and arrows.hitTestDrawing/pickDrawings/pickTopmostDrawing— hit testing for selecting drawings on a board.composeDrawingTransforms/transformBoardPoint/transformFromPivotGesture— 2D affine transforms for moving, scaling, and rotating drawings.drawingsToSvg/drawingsToSvgPath/drawingsToJson— export helpers for rendering or serializing a set of drawings.
import { hitTestDrawing, pickTopmostDrawing } from "@remotedraw/geometry";
const hit = pickTopmostDrawing(drawings, point, { strokeWidth: 6 });Most integrations consume this indirectly through @remotedraw/react, which
re-exports the pieces it uses for selection and rendering. Depend on it
directly for custom board UIs or server-side geometry (export, hit testing)
outside a @remotedraw/react app.
