SVG + DOM overlay that paints one or more 3D angle measurements
on a View's canvas. Each measurement is a
corner vertex and two arms running to an origin and target
anchor, labelled with the interior angle in degrees.
Mirrors the shape of V2's AngleMeasurementsPlugin, but rendered
with SVG + DOM (no second renderer or off-screen canvas). One
AngleMeasurementsTool per View owns
the overlay and a keyed collection of
AngleMeasurements; an optional
MouseAngleMeasurementsControl turns canvas clicks into
measurements with three-click creation
(origin → corner → target).
Per-View singleton —
openFor is idempotent;
re-calling for the same View brings the existing tool back to
the foreground.
SVG + DOM overlay — no second renderer or off-screen
canvas; the overlay shares the View canvas's stacking context
so letterboxing and CSS transforms apply uniformly.
Three-anchor angle — each measurement renders the two arm
wires (origin → corner, corner → target) plus an angle label
in degrees at the corner. Toggle wires and labels
independently via
AngleMeasurementParams.
Default colour is purple to distinguish from
DistanceMeasurement's orange.
Snap-aware picking — the tool routes mouse clicks through
a caller-supplied PickStrategy.
Supply a RoutingPickStrategy
for snap-to-vertex / snap-to-edge; omit picker to get a
default BVH-only picker built from the View's Scene.
Lazy mouse control — tool.mouseControl lazily constructs
the MouseAngleMeasurementsControl on first access, so a
tool used purely programmatically never pays its setup cost.
Coarse change event —
onMeasurementsChanged
fires after every create / destroy / clear; listeners that
need the current contents re-read the
measurements map.
tool.mouseControl is lazy — first access constructs the helper.
activate() starts listening for clicks on the View canvas;
Esc cancels an in-progress measurement; deactivate() stops
listening.
tool.mouseControl.activate();
// ...later, when the user picks a different tool: tool.mouseControl.deactivate();
5) Snap-aware picking
Pass a RoutingPickStrategy
as picker to get snap-to-vertex and snap-to-edge in
mouse-driven creation. Omit picker for a BVH-only fallback.
onMeasurementsChanged is coarse — it fires once per
create / destroy / clear without the changed id. Listeners that
need the current state re-read
measurements.
Angle Measurements
SVG + DOM overlay that paints one or more 3D angle measurements on a View's canvas. Each measurement is a corner vertex and two arms running to an origin and target anchor, labelled with the interior angle in degrees.
Mirrors the shape of V2's
AngleMeasurementsPlugin, but rendered with SVG + DOM (no second renderer or off-screen canvas). One AngleMeasurementsTool per View owns the overlay and a keyed collection of AngleMeasurements; an optional MouseAngleMeasurementsControl turns canvas clicks into measurements with three-click creation (origin → corner → target).Shape
Features
DistanceMeasurement's orange.pickerto get a default BVH-only picker built from the View's Scene.tool.mouseControllazily constructs the MouseAngleMeasurementsControl on first access, so a tool used purely programmatically never pays its setup cost.Installation
Quick Start
1) Import the entry points
2) Open the tool on a View
openForis the canonical entry — idempotent, View-keyed, and shows the existing tool again if it was hidden.3) Create a measurement programmatically
Pass three world-space anchors. The tool computes the angle between the two arms at
corner; the label updates every frame as the camera moves.4) Wire up mouse-driven creation
tool.mouseControlis lazy — first access constructs the helper.activate()starts listening for clicks on the View canvas;Esccancels an in-progress measurement;deactivate()stops listening.5) Snap-aware picking
Pass a RoutingPickStrategy as
pickerto get snap-to-vertex and snap-to-edge in mouse-driven creation. Omitpickerfor a BVH-only fallback.6) React to changes
onMeasurementsChangedis coarse — it fires once per create / destroy / clear without the changed id. Listeners that need the current state re-read measurements.7) Show, hide, toggle
Visibility on the tool hides the entire overlay; per-measurement visibility flags hide individual measurements while the overlay stays mounted.
8) Tearing down
destroytears down the overlay, every child measurement, and the camera-update subscription. Idempotent.