Compare two map layers, and two dates, side by side - #336
Open
sandesh-sp wants to merge 4 commits into
Open
Conversation
Comparison mode gains a second layout: 'sideBySide' draws two panes that meet at the divider, each with its own camera locked to the same centre and zoom and its own basemap, alongside the existing 'swipe' wipe over a single view. Each side can also be pinned to its own date. MapComparison turns a side's ISO instant into per-layer prop overrides and hands them to the engine, which applies them to that side's layer clones without deriving anything itself. Exposed through the mmgisAPI bus as 'map:comparison:setLayout' and the 'layout'/'leftDate'/'rightDate' fields on enable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Adds a two-sided comparison mode to the map so a user can hold two layer sets — or the same layers at two different dates — against each other in one viewport.
Two layouts share a single draggable divider:
swipe— one camera, one basemap. Both sides draw the same view and the divider wipes between them, so a place is seen under one layer or the other.sideBySide— two cameras locked to the same centre and zoom, each with its own basemap, in panes that meet at the divider without overlapping. A place is seen under both layers at once, once per pane.Either side can be pinned to its own ISO instant.
MapComparisonturns that instant into per-layer prop overrides and hands them to the engine; the engine applies what it is given to that side's layer clones and derives nothing itself. A side left unpinned follows the global timeline like any other layer.Everything is driven through the
mmgisAPIevent bus — no plugin code is hardcoded in the core, and the engine surface is optional methods onIMapEngine, so an engine that does not implement them degrades to a warning rather than a crash.Proposed Changes
MapComparisoncontroller — owns the divider DOM, the layout, the divider position, and each side's layers/date.comparisonTimePins.ts— turns a per-side date into the layer prop overrides that redraw that side at that instant.sideBySidelayout inDeckGLAdapter: a second deck instance with its own basemap, cameras locked to the same centre/zoom, panes clipped to meet at the divider.mmgisAPIrequestsmap:comparison:enable/disable/setLeftSide/setRightSide/setLayout/setDividerPosition/getState, and eventsmap:comparison:dividerMoved/layoutChanged.setComparisonLayout/getComparisonLayoutand thelayout,leftLayerProps,rightLayerPropsfields onComparisonConfiginIMapEngine.DeckGLAdapter, needed to keep the two side-by-side cameras in lockstep.vitest.config.tsaliasesPDFViewerto a stub — it holds JSX in a.jsfile, which Vite's default.jsloader will not parse, and anything reachingLayers_pulls it in transitively.Issues
Testing
Full unit suite on macOS (Darwin 25.5.0), Node 20:
Of those, 6 files / ~90 tests are new here and cover this feature directly:
mapComparisonLayout,mapComparisonDates,comparisonTimePins,deckGLSideBySide,deckGLComparisonProps.Still worth a live smoke test on a real mission config before merge — dragging the divider in both layouts, and confirming a date-pinned side redraws against tiles for that date.