LayerManager Theme Reapply State
"/home/yossef/notes/git/projects/maplibra/risks/LayerManager Theme Reapply State.md"
path: maplibra/risks/LayerManager Theme Reapply State.md
- **fileName**: LayerManager Theme Reapply State
- **Created on**: 2026-06-16 00:48:42
LayerManager Theme Reapply State
Migrated from: obs_vault
Parent: ./Theme Risk Index.md
Severity: medium-high.
Summary
LayerManager.reapplyThemeColors() updates some indoor layers explicitly, but doors, fast wall line layers, and some style-name heuristic cases can keep old colors or throw warnings during theme changes.
Code Evidence
src/layer-manager.js: lines 50-63 updatebuilding-shellandlabelsexplicitly.src/layer-manager.js: lines 65-91 loop overstyleLayerIdsand setfill-extrusion-colorregardless of actual layer type.src/layers/base/doors.js: lines 68 and 111 create doors withthis.themeColors.Doors, butreapplyThemeColors()does not updatedoorslater.src/layers/base/style-layer.js: lines 145-172 create fast wall layers aslinelayers and track them instyleLayerIds.src/layers/base/style-layer.js: lines 64, 132, and 267 classify walls withstyleName.includes('Walls').
Trigger Conditions
- User toggles theme after doors have been rendered.
- Theme changes while fast wall line layers exist before prepared 3D wall layers replace them.
- MVF style names differ from expected token names or contain misleading
Wallssubstrings. - Unknown MVF style colors are light or near-light.
Likely Symptoms
- Doors keep old dark/light color after theme switch.
- Fast wall lines log warnings and keep stale line color.
- A non-wall style with
Wallsin the name is buffered/extruded like a wall. - A real wall style with different casing or naming is treated like a room.
- Light mode may darken unknown light MVF colors due to a dark fallback heuristic.
Why It Matters
Indoor map theme is not one layer. It includes generated style layers, doors, labels, shell, feature-state expressions, and zoom opacity expressions. If one path is missed, the UI looks partially themed and can become low contrast.
Current Tests
tests/style-layer.test.jscovers fast wall line creation and replacement by prepared 3D walls.tests/visibility-manager.test.jscovers annotation marker visibility only.- No direct tests for
LayerManager.setTheme()orreapplyThemeColors().
Missing Tests
reapplyThemeColors updates doors fill extrusion color.reapplyThemeColors uses line-color for fast wall line layers.reapplyThemeColors preserves selected and hover feature-state expression.style color fallback only darkens light MVF colors in dark theme.wall classification handles lowercase or semantic metadata without substring false positives.theme switch preserves building-shell visibility and zoom opacity transition.
How To Make Better
- Make
reapplyThemeColors()type-aware: useline-colorforline,fill-colorforfill, andfill-extrusion-colorforfill-extrusion. - Add explicit repaint for
doors. - Add a semantic themed-layer registry instead of relying only on
styleLayerIds. - Centralize style classification in a helper like
classifyMvfStyle(styleName, style). - Make unknown-style light color coercion conditional on dark theme and use luminance instead of a hardcoded hex list.
- Extract shared helpers for label colors and door colors so initial render and reapply use the same logic.
Debug Steps
- Toggle theme after doors and labels are visible.
- Inspect
map.getPaintProperty('doors', 'fill-extrusion-color')before and after. - If fast wall mode is active, inspect layer type for each
styleLayerIdsentry. - Watch console for
Failed to update theme for layer ...warnings. - Inspect whether
building-shelllayout visibility changed.
See Also
-
continue:[[]]
before:[[]]