ekke 577d94ef5b Legend panel: new Map() was building an OpenLayers map, not a JS Map
MapView.js imported OpenLayers' map class as a bare `Map`, which shadowed the
global Map for the whole module. `this._legendEntries = new Map()` therefore
constructed a second, target-less OpenLayers map, and the legend registry was
never a Map at all.

Two things kept this hidden. Storing an entry did not throw, because ol/Map
extends ol/Object, which has its own set(key, value) — the wrappers were filed
silently into an OpenLayers property bag and discarded. The for...of in
_updateLegendPanel did throw, since an OpenLayers map is not iterable, but it is
inside a try/catch and only ever surfaced as "legend panel update failed:
TypeError: {} is not iterable". Safari prints the object as {} and its
constructor is also named Map, which is why the warning read as if a plain
object had appeared from nowhere.

So the legend panel has never shown a legend for any layer, which would have
been visible during the layer walkthrough in the board demonstration.

Fixed by removing the shadowing rather than working around it: the import is now
OLMap, the map is constructed with it, and new Map() is the real global Map
again. Verified in a browser against the dev server — the registry is now a Map
with Symbol.iterator, it holds the Digital Earth Africa slope entry, and
_updateLegendPanel runs without throwing. Only this file imported ol/Map.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-10-21 09:33:47 +02:00
..
2026-03-04 12:59:40 +01:00