screentinker/Examples
ScreenTinker b8c127f766 Examples/weather-radar: keep the map centred and bounded
The auto-framing fitted the view to whatever warning polygons were active, so a
storm a few counties away pulled the frame out to cover it and the configured
area shrank to an unreadable corner of a half-state view. On signage that is
read at a glance, a map that wanders is worse than one that shows less.

Framing is now centred and bounded:

- The map never pans. The centre stays on the configured point and only the
  zoom responds, because the box handed to fitBounds is symmetric about home.
- Zoom-out is capped at `max_counties` (default 2) county-widths in every
  direction, with longitude scaled by cos(lat) so the budget is the same
  distance on the ground north and south.
- Warnings entirely outside that box are not chased at all; the configured view
  is held. Warnings clearing returns to it rather than staying parked on the
  last storm.
- A floor on the frame keeps one small cell overhead from zooming to street
  level, and fit padding drops to 24px, which on a PiP-sized overlay was
  discarding a third of the width per side.

The overlay assets are served max-age=14400, so a player that had already
loaded them kept the old copy for four hours and silently ignored a redeploy.
The page URL and its script tag now carry a version, documented to be bumped
together.

Tests cover the invariants against the shipped frameFor source rather than a
copy of it: centred after reframing, capped at the county budget, small cells
floored, distant storms not chased.
2026-07-27 12:26:08 -05:00
..
PIP-Air-Quality Add PiP overlay example recipes (#132) 2026-06-18 20:20:37 -05:00
PIP-Announce-Broadcast Add PiP overlay example recipes (#132) 2026-06-18 20:20:37 -05:00
PIP-CAP-AU-Alert-Monitor Add PiP overlay example recipes (#132) 2026-06-18 20:20:37 -05:00
PIP-Crypto-Ticker Add PiP overlay example recipes (#132) 2026-06-18 20:20:37 -05:00
PIP-Event-Countdown Add PiP overlay example recipes (#132) 2026-06-18 20:20:37 -05:00
PIP-Fundraiser-Thermometer Add PiP overlay example recipes (#132) 2026-06-18 20:20:37 -05:00
PIP-Incident-Webhook Add PiP overlay example recipes (#132) 2026-06-18 20:20:37 -05:00
PIP-News-Ticker Add PiP overlay example recipes (#132) 2026-06-18 20:20:37 -05:00
PIP-QR-Rotator Add PiP overlay example recipes (#132) 2026-06-18 20:20:37 -05:00
PIP-Room-Status-Calendar Add PiP overlay example recipes (#132) 2026-06-18 20:20:37 -05:00
PIP-USD-Cap-Alert-Monitor-NOAA Add PiP overlay example recipes (#132) 2026-06-18 20:20:37 -05:00
PIP-Weather-Radar Examples/weather-radar: keep the map centred and bounded 2026-07-27 12:26:08 -05:00
PIP-Weather-Widget Add PiP overlay example recipes (#132) 2026-06-18 20:20:37 -05:00
PIP-Welcome-Board Add PiP overlay example recipes (#132) 2026-06-18 20:20:37 -05:00