Prefer openFor — it dedupes per-View. Direct construction works but will replace any prior tool on the same View.
ReadonlydefaultReadonlymeasurementsAll measurements currently mounted, keyed by id.
ReadonlyonFires when the measurements map changes — after every createMeasurement, destroyMeasurement, and clear call. Coarse-grained: a listener that needs the current contents should re-read the measurements map.
ReadonlypickerReadonlyviewTrue once destroy has run.
Returns the lazily-built MouseDistanceMeasurementsControl bound to this tool. The control is inactive until activate() is called.
InternalProject a world-space point to the overlay's CSS-pixel space,
writing [canvasX, canvasY, w] into out. w ≤ 0 ⇒ behind
the camera; the caller should hide the corresponding glyph.
Destroy every measurement currently registered.
Create a new measurement from explicit world-space anchors.
The tool assigns an id when the caller doesn't, and asserts that supplied ids are unique within this tool.
Destroy a single measurement by id. No-op if unknown.
StaticgetStaticiconSVG glyph used in context-menu rows that toggle this widget —
a slim ruler. Strokes use currentColor.
StaticopenIdempotent factory — returns the existing tool for DistanceMeasurementToolParams.view, or constructs one. If the existing instance was hidden it's shown again.
DistanceMeasurementTool — overlay widget that renders one or more DistanceMeasurements on a View's canvas.
Mirrors the shape of V2's
DistanceMeasurementsPluginbut rendered with SVG + DOM (no second renderer or off-screen canvas).Interactive creation lives on mouseControl — see MouseDistanceMeasurementsControl.
Lifecycle
One tool per View; the registry key is the View itself, so openFor / getFor are idempotent.
destroy()tears down the overlay, all child measurements, and the camera-update subscription.