prop/assets/js
Graham McIntire aa8b789d2e
feat(weather/map): persist viewport to URL for reload-stable view
Adds lat/lon/zoom URL params to /weather so reload / share-link
restores the exact map state. The existing ?layer= param keeps
working alongside.

LiveView side:

- mount() reads lat/lon/zoom from query params, clamps to valid
  ranges (lat -90..90, lon -180..180, zoom 4..10), and falls back
  to DFW@z7 when missing or invalid. Initial values flow to the
  hook via three new data attributes.
- handle_event("viewport_changed", ...) accepts {lat, lon, zoom}
  pushed by the hook on debounced moveend, clamps + rounds, and
  push_patches the URL with replace: true so browser history
  doesn't grow an entry per pan tick.
- build_path/2 helper centralises URL construction so select_layer
  and viewport_changed both produce a deterministic param order
  (layer, lat, lon, zoom). Tests assert exact URLs.

JS hook side:

- mounted() reads data-initial-lat/lon/zoom from the el dataset
  with parseFloat/parseInt + Number.isFinite gates, then seeds
  Leaflet's center/zoom from those instead of the previous
  hardcoded (32.897, -97.038, 7).
- moveend handler now also schedules a 400 ms-debounced
  pushEvent("viewport_changed", {lat, lon, zoom}) so the URL
  catches up with whatever the user panned/zoomed to. Separate
  debounce timer from the cells fetch since the URL push and the
  network fetch have different cadence sweet spots.

Tests cover: initial seeding from URL params, clamping of bad
values, viewport_changed event producing the right patched URL,
and the original layer-shareability test (now expecting the full
viewport in the URL).
2026-04-30 09:10:36 -05:00
..
types feat(eme): 3D WebGL Earth-Moon globe with lazy-loaded Three.js 2026-04-23 17:00:53 -05:00
app.ts feat(rover-locations): inline satellite map per location 2026-04-26 13:55:08 -05:00
beacon_map_hook.ts feat(format): miles-primary distance formatting sitewide 2026-04-18 15:53:40 -05:00
beacons_list_map_hook.ts Beacon list map, profile page polish, nav ordering fix 2026-04-12 16:23:09 -05:00
contact_map_hook.ts refactor: normalize pos1/pos2 JSONB key to 'lon' everywhere 2026-04-17 09:10:32 -05:00
contacts_map_hook.ts feat(format): miles-primary distance formatting sitewide 2026-04-18 15:53:40 -05:00
elevation_profile_hook.ts feat(canopy): add tree-canopy height layer for path obstruction analysis 2026-04-26 12:51:48 -05:00
eme_globe_hook.ts feat(eme): 3D WebGL Earth-Moon globe with lazy-loaded Three.js 2026-04-23 17:00:53 -05:00
format.ts feat(format): miles-primary distance formatting sitewide 2026-04-18 15:53:40 -05:00
horizontal_wheel_scroll_hook.ts feat(rover): make candidate strip scroll horizontally + wheel-to-h-scroll 2026-04-26 09:31:10 -05:00
locate_me_hook.ts Convert all JavaScript to TypeScript with type annotations 2026-04-11 16:59:28 -05:00
location_map_hook.ts fix(rover-locations): use circleMarker; default marker icons aren't bundled 2026-04-26 14:03:10 -05:00
maidenhead_grid.ts feat(grid): show full Maidenhead label at subsquare zoom (em13sf, not sf) 2026-04-26 09:54:08 -05:00
path_forecast_hook.ts feat(path): hover-on-dot factor breakdown + tag fallback factors 2026-04-25 15:33:19 -05:00
propagation_map_hook.ts perf(map): /scores/cells binary endpoint, client-side fetch + band/time prefetch 2026-04-29 14:27:20 -05:00
rover_map_hook.ts feat(rover): add ESRI satellite imagery as base-layer option 2026-04-26 11:52:12 -05:00
rover_slider_hook.ts feat(rover): replace max-drive-time slider with max-distance in miles 2026-04-25 17:21:57 -05:00
weather_map_hook.ts feat(weather/map): persist viewport to URL for reload-stable view 2026-04-30 09:10:36 -05:00