Skip to content

Fix/basemap picker availability - #13

Merged
TommySquared merged 4 commits into
mainfrom
fix/basemap-picker-availability
Sep 17, 2026
Merged

TommySquared merged 4 commits into
mainfrom
fix/basemap-picker-availability

Conversation

@TommySquared

Copy link
Copy Markdown
Collaborator

Map shell fixes: basemap picker, theme pinning, draw layering, freehand

Base: main · 4 commits · server/mapcontrol_server/main.py (+108 / −10)

A batch of fixes to the served map shell surfaced while working through the EOGPT
map drawer, plus a new freehand draw mode.

What changed

Hide unavailable basemaps from the picker (9f745ff)
Config-load only drops basemap entries whose provider key env var is unset — a
set-but-invalid/plan-limited key still listed every style with blank previews that
broke on click. The picker now probes each entry's preview tile client-side and
removes failing tiles (pruning emptied group sections, hiding the control if <2
remain). The current basemap is never removed.

Freehand polygon draw mode (7327306)
Adds Terra Draw's TerraDrawFreehandMode as a fifth toolbar tool. Finished shapes
are Polygon geometry and flow through the existing pipeline as draw_type: 'polygon', so no server/SDK/consumer changes are needed; enable_drawing
accepts 'freehand'/'freedraw'. Included in the theme-flip restyle observer.

Pin ?theme= against snapshot replay; keep the globe surround dark (83c2368)

  • An explicit ?theme= from the embedding page now wins over the stored map-level
    theme on session_snapshot restore (same rule as ?basemap=). Previously every
    WS (re)connect replayed the persisted/auto theme over the boot param, flipping
    a light-booted page's controls dark (or resolving auto to the OS preference
    regardless of the embedder). Live set_theme broadcasts still apply.
  • The canvas surround behind the globe is now a fixed deep navy in both themes
    instead of --eo-bg, which rendered a white void behind the planet in light mode.

Picker hover, sketch layering, draw cursor (8624b28)

  • MapLibre's stock .maplibregl-ctrl button:hover (translucent) outranked the
    picker's themed hover on specificity, blanking the trigger over the map on hover.
    Re-asserted the themed surfaces (trigger, tiles, draw-toolbar) at higher
    specificity — hover is now just the border/surface highlight.
  • Keep the live Terra Draw sketch (td-*) and dashed pending previews above every
    asset layer via raiseDrawLayers(), called after each asset add, move_layer,
    and reorder_assets — they could otherwise be buried by new overlays/reorders.
  • Crosshair cursor while a draw mode is armed (same class-on-canvas pattern as
    delete mode); the grab cursor read as "pan."

Testing

  • python -c "import mapcontrol_server.main" imports clean (f-string HTML intact).
  • Exercised the picker, freehand draw, theme flips, and draw/reorder layering
    against the local stack via the dev-mc2 compose override.

Notes for reviewers

  • The theme-pinning fix is the mc2 half of the eogpt "map ignores theme flips"
    bug; the eogpt half (forwarding set_theme on theme change) ships in that repo.
  • All changes are in the served-shell HTML/JS string in main.py; there are no
    Python API or model changes.

TommySquared and others added 4 commits September 16, 2026 21:08
Config-load only drops basemap entries whose provider key env var is
UNSET — a set-but-invalid/plan-limited key still lists every style, so
the picker showed blank previews that broke when clicked. Probe each
entry's preview tile client-side and remove failing tiles (pruning
emptied group sections, hiding the control if <2 remain). The current
basemap is never removed since it is demonstrably rendering.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adds Terra Draw's TerraDrawFreehandMode as a fifth toolbar tool
('freedraw'). Finished freehand shapes produce Polygon geometry and
re-enter the existing pipeline as draw_type 'polygon', so the server
and SDK need no new type; enable_drawing accepts 'freehand'/'freedraw'
aliases. Styled with the shared area styles and included in the
theme-flip restyle observer.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… light mode

- An explicit ?theme= from the embedding page now wins over the stored
  map-level theme on session_snapshot restore (same pinning rule as
  ?basemap=). Previously every WS (re)connect replayed the persisted or
  'auto' theme over the boot param, flipping a light-booted page's
  controls dark (or resolving 'auto' to the OS preference regardless of
  the embedder's theme). Live set_theme broadcasts still apply.
- The canvas surround behind the globe is space — keep it deep navy in
  both themes instead of binding to --eo-bg, which rendered a white void
  behind the planet in light mode.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…wing

- MapLibre's stock control hover (.maplibregl-ctrl button:hover →
  translucent rgba(0,0,0,.05)) outranked the picker's themed hover on
  specificity, replacing the trigger's solid surface with near-
  transparency over the map. Re-assert the themed surfaces (trigger,
  tiles, draw-toolbar buttons) at higher specificity — hover is now just
  the border/surface highlight.
- Keep the live Terra Draw sketch (td-*) and dashed pending previews
  above every asset layer: new overlays append to the top of the style
  and reorder/move_layer lift assets, either of which buried an
  in-progress drawing. raiseDrawLayers() re-tops them after any asset
  layer add, move_layer, and reorder_assets.
- Crosshair cursor while a draw mode is armed (same class-on-canvas
  pattern as delete mode) — the grab cursor read as "pan", hiding that
  the map was ready for sketching.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@TommySquared
TommySquared merged commit b710d9e into main Sep 17, 2026
3 checks passed
@TommySquared
TommySquared deleted the fix/basemap-picker-availability branch September 17, 2026 05:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant