updated mapview for compare mode #1266
Open
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.
Background
Map views get un-synced when dataset has default view. The bug occurs when user
What approach was taken?
For compare mode, used to hold previous mapView state in a React state variable when creating the second map (map1). However, this state variable was not updated when users panned or zoomed the map, causing it to become stale. When toggling compare mode off and back on, map1 would be recreated using this outdated mapView state rather than map0's current view position, resulting in the maps displaying different areas.
The fix was to directly retrieve map0's current view using map0.getView() when creating map1, ensuring both maps share the same viewport regardless of any intermediate navigation that occurred while compare mode was disabled.
Anything in particular that should be highlighted?
For datasets with default location, the view moves to that location. Should map0 be used as a reference for default location?
Checks
black ..Hint To run all python unit tests run the following command from the root repository directory: