View on GitHub

leaflet-city-mapper

A small 3D rendering engine for leaflet

Picking

Source guide Project README

Converts pointer events into scene raycasts, feature hits, hover highlighting and tooltips. Model hits and batched source features are resolved differently.

Pointer to feature

flowchart LR
  Pointer["Pointer move"] --> Gesture{"Gesture active?"}
  Gesture -->|yes| Clear["Clear hover"]
  Gesture -->|no| Ray["Raycast attached scene"]
  Ray --> Model["Model: walk hit-node parents"]
  Ray --> Batch["Source: search face ranges"]
  Model --> Hover["Highlight + tooltip + featurehover"]
  Batch --> Hover

Face ranges come from geometry; keep them aligned with triangle order. A missing hit may also mean the root or camera is not attached.

Related: collision, native, scene.