Repository navigation
Engine v1.0.21
Adds the map's zoom level to the shareable URL, so a refreshed, copied or embedded link reopens at the view it was shared at. One changed block, no new blocks — adopting forks need no fence seeding and nothing outside the fence.
- Changed
permalink: the hash gains&zoom=N. Emitted only when the map has moved off the fork's boot zoom, so an untouched map still produces a clean, hash-free URL and existing links are unaffected.zoomendrefreshes the hash — point and layer changes already calledsyncUrlHash, but a zoom changes no app state, only the view, so it had no hook. On restore, an unparseable or out-of-range zoom is ignored rather than clamped: a link made in a fork with different zoom limits should fall back to the receiving fork's default view, not to its nearest edge.
The boot zoom is read from the map, not configured. var bootZoom = map.getZoom() runs inside the block, which is safe because nothing between map creation and the permalink block changes the zoom, and applyStateFromHash() runs at the end of boot. That choice is what keeps this a bytes-only bump: a DEFAULT_ZOOM METRO constant would have been the obvious design, and it would have required every sibling to add a variable outside the fence before the new block could run — which a bump PR does not do, so the forks would have broken on a ReferenceError at boot. When an engine block needs a fork-specific value, prefer reading it from something every fork already has over introducing a constant every fork must be taught.
Restoring a point and a zoom together needs skipPan. setSelectedPoint's pan is animated and goes to at least zoom 15. An animation in flight settles after anything applied synchronously afterwards, so applying the shared zoom post-hoc was silently overwritten by the pan that was already running — #point=…&zoom=9 restored at 15. The block now passes { skipPan: true } when the link carries its own zoom and frames the view itself. Measured in a browser, not reasoned about: the first implementation looked correct and failed one of thirteen checks.
Note for readers of the resulting URLs: because selecting a point auto-zooms to 15, point permalinks now carry &zoom=15. That is accurate — the map is at 15 — and it reproduces the view exactly.
Not in this release: Chicago also widened its own map from minZoom: 9, maxZoom: 18 to 7..19, because its served area now spans 4.29° of latitude and could not be seen whole at zoom 9. That is on the map-construction line, outside every fence, and is Chicago-only — each fork sets its own limits to fit its own coverage. A fork adopting this release should check that its minZoom still lets a reader see everything it serves, since the permalink can now carry a zoom that its own map would refuse.