Implement building selection panel and enhance building interaction; add functionality to display building details upon selection, including name, type, height, and source link. Update UI components for building interaction and integrate new styles for the building panel. Refactor related code for improved building data handling and selection logic.

This commit is contained in:
Leonid Pershin
2026-08-17 11:12:18 +03:00
parent 0926ec879c
commit adda6fa856
19 changed files with 718 additions and 5 deletions
+15
View File
@@ -204,6 +204,21 @@ The maths lives in `sky.ts`, which imports no PixiJS and is unit-tested; `weathe
paint the result. A dark theme pulls the night wash back rather than switching it off, because the map is
already drawn dark and dusk still has to feel like dusk.
### Picking a building
Clicking a footprint selects it and opens a panel with its name, type, height, floors, footprint area and a
link to the original OpenStreetMap element. The hit test runs against the chunk data the client already has
cached, so it costs no request: `picking.ts` ray-casts the point against every loaded footprint and takes the
**smallest** match, because where footprints overlap the big one is nearly always the container and the small
one is what the player can see the edges of. A courtyard punched out of a block counts as outside it.
Panning always nudges the pointer, so a press only counts as a click if it moved less than a few pixels —
otherwise dragging the map would reselect on every release. A second finger cancels the click outright, since
that is a pinch. Clicking bare ground, pressing Escape or the panel's close button clears the selection.
The highlight is redrawn whenever the camera moves: the container is scaled, so a stroke of fixed world width
would thin to nothing as you zoom out.
Place names are drawn in screen space so text keeps a constant size at every zoom, and the work is split in
two. `labelPlacement.ts` decides *which* names to show: candidates are ranked — water bodies first, then
arterials, then land cover, then side streets — and placed greedily, dropping anything that would overlap a