describe.ts

src/scene/describe.ts
// Single source for hover-tooltip text, so 2D and 3D always label/measure the
// same element the same way (they can't drift). Each helper returns the label
// and a dimensions string; the views add the cursor position.
import { polygonArea, polygonBounds, wallLength } from './geometry';
import type { Fixture, Opening, Room, Scene, Wall } from './schema';
import { formatArea, formatLength, type UnitSystem } from './units';
export type Described = { label: string; dims: string };
/** A selected element: which one (id) + its description. */
export type Selected = Described & { id: string };
/** 2D selection anchored at a scene-space point (re-projected to screen each render). */
export type Selected2D = Selected & { sx: number; sy: number };
/** 3D selection anchored at a world-space point (tracked by <Html> as the camera moves). */
export type Selected3D = Selected & { point: [number, number, number] };
/** Highlight color for the selected element (fill or lines), both 2D and 3D. */

Showing the first 20 lines.

Get full code

Support

Talk to the developers of this project to learn more

We have been building professional websites for big clients for over 15 years. Gallop templates and blocks is our best foundation for SEO websites and web apps.

© 2026 Web Plant Media, LLC