Skip to content

Share link: carry the comparison and reopen it on load - #644

Open
BhattaraiSijan wants to merge 2 commits into
feat/tools-url-statefrom
feat/616-comparison-url-state
Open

BhattaraiSijan wants to merge 2 commits into
feat/tools-url-statefrom
feat/616-comparison-url-state

Conversation

@BhattaraiSijan

@BhattaraiSijan BhattaraiSijan commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #616. Part of #613. Stacked on the tools-url-state PR; retarget to development once that merges.

Summary

With comparison on, copying the link gave a plain map with both sides' layers stacked. The link now carries the comparison and reopens it.

  • ComparisonTool.getUrlString writes mode, layout, the two layers, the compare date, the swap and the divider position as a |-separated entry. The link encodes each tool's entry, so the codec strips only its own separator. The panel reports its arrangement to the module as it changes; the divider is dragged on the map, so the module follows map:comparison:dividerMoved itself.
  • On load, once mission load registers the tool handlers, the tool reads its entry back over tool:getUrlState, seeds the panel, asks core to show the plugin, and applies the divider after the enable settles, since enabling resets it to the middle.
  • The link is applied once. The entry is read when the tool handlers come up and handed to the first panel; closing clears it, so a panel re-mounted from "Compare layer" starts from that hand-off, not from the link.
  • A layer the link names that the map no longer draws leaves its side empty and says so in the panel: "The link named a layer this map no longer has, so the left side is empty." Picking a layer for that side clears the line. A layer the user switches off later ends its side as before, without the line.
  • The sides sent to core are derived from layers the map draws, so a missing id never reaches map:comparison:enable; before, the first render enabled with it and the next disabled.

Not in this PR

  • Leaflet, which has no comparison mode.

Test plan

  • npx vitest run: 223 files, 3824 tests pass; npx tsc --noEmit clean
  • Unit: the link's divider is applied after the first enable; a missing layer empties its side with the notice and no enable; picking a layer clears the notice; a layer switched off later gets no notice; the link seeds the first panel once and a re-mounted panel gets none
  • Air4US: open a link naming a layer, switch that layer off in Configure or edit the id in the link, open it: the panel shows the notice and the other side's layer
  • Air4US, layers mode, swipe at ~30%: copy link, open in a new tab, the panel opens with the same layers, layout and divider
  • Same for dates mode and side-by-side
  • A link copied with comparison off opens as today

🤖 Generated with Claude Code

…ger has

The notice sits above the action row and clears when a layer is picked for that side; a layer the user switches off later ends its side as before, without it. The sides sent to core are derived from drawn layers only, so a missing id never reaches map:comparison:enable. With the link encoding each tool's entry, the codec strips only its own separator. Tests pin the divider applied after the first enable and the link seeding the first panel once.
@BhattaraiSijan
BhattaraiSijan force-pushed the feat/616-comparison-url-state branch from 6fe22bb to 84b7829 Compare November 19, 2026 16:47

This branch has not been deployed

No deployments
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