Repository navigation
Map: show the basemap's scale bar and compass, and carry them into exports - #612
Open
BhattaraiSijan wants to merge 5 commits into
Open
BhattaraiSijan wants to merge 5 commits into
BhattaraiSijan wants to merge 5 commits into
Conversation
This branch has not been deployed
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.
Closes #570. Closes #576. Supersedes #574 and #578.
Summary
A mission's basemap can now show the map library's own scale bar and compass, and exports carry them.
msv.basemap.controlsholdsscaleBar { show, units, position }andcompass { show, position }.showis the switch; a mission without the key shows nothing, so existing missions are unchanged.ScaleControl(100 px, metric or imperial) and a compass-onlyNavigationControlthat turns with the bearing, tips with the pitch and resets the view to north on click. Each side-by-side comparison pane gets its own. Controls live on the map object, so basemap style switches keep them. Standalone deck.gl (no basemap provider) draws none.L.control.scale. Leaflet cannot rotate, so no compass.Why not compute the scale ourselves
MapLibre's and Mapbox's scale controls already do the one thing a scale bar needs: unproject two points on the centre row and measure the distance between them. #574 reimplemented that through the engine interface to support a plugin placed in any float panel and the scale under the pointer. A scale bar is map chrome, so this takes the library's control instead, which removes the plugin, the
map:getMetersPerPixelandmap:mouseoutbus additions, and the per-framemoveemission. What stays from #574 is the canvas renderer for the exported bar and the tilt rule.Not in this PR
float-top-rightpanel can cover atop-rightcontrol; the position dropdowns are the workaround.Test plan
npx vitest run tests/unit: 161 files, 2916 tests pass🤖 Generated with Claude Code