feat(hex): layer-panel toggle + remove control for hex layers (#318) - #319
Merged
Conversation
Hex tile layers are added at runtime, after generateControls() builds the layer panel once at boot, so they never got a panel row — the only way to hide or clear one was to ask the LLM. - Factor per-layer row creation into _createLayerItem(), shared by generateControls() and a new _addLayerControl() that appends a single row incrementally (avoids a full re-render, which would reset user-toggled group collapse state). - addHexTileLayer() now calls _addLayerControl(); the row carries the same visibility checkbox as other layers plus a remove (×) button. - The remove button is hex-only: it wires to the existing removeHexTileLayer() (curated layers have no remove path, only hide). removeHexTileLayer() now also drops the panel row. Covered by test/map-manager.hex-panel.test.js (jsdom).
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||
cboettig
added a commit
to boettiger-lab/geo-agent-template
that referenced
this pull request
Jul 14, 2026
Pin all four CDN refs to the head of PR boettiger-lab/geo-agent#319 to test the hex-layer visibility toggle + remove control before merge. Return to a release tag when done.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #318.
Problem
Hex tile layers are added at runtime (
add_hex_tile_layer→addHexTileLayer), aftergenerateControls()builds the layer panel once at boot (main.js:99). They land in the samethis.layersregistry as curated layers, but the panel is never re-rendered, so a hex layer never gets a panel row. The only way to hide or clear one was to ask the LLM.Change
generateControls()into_createLayerItem(layerId, state), shared by boot rendering and a new_addLayerControl(layerId)that appends a single row incrementally. Incremental append (rather than a fullgenerateControls()re-render) avoids resetting user-toggled group-collapse state.addHexTileLayer()now calls_addLayerControl(). The row carries the same visibility checkbox as every other layer, plus a remove (×) button.removeHexTileLayer(). Curated layers have no remove path (only hide), so they get no button — this mirrors the existing backend guard rather than inventing a destroy path for curated layers.removeHexTileLayer()now also removes the panel row.Notes / scope
Testing
test/map-manager.hex-panel.test.js(jsdom, 5 tests): hex row gets a remove button, curated row doesn't; checkbox reflectsvisible;_addLayerControlappends once and is idempotent + no-op before panel build; clicking remove tears down the map layer, source, registry entry, and panel row.map-manager.jsis browser-bound; visual/interaction check on a deployed app still recommended (panel styling, × button placement in light/dark).