Repository navigation
Map Control: add a compass that shows north and tilt, and resets the view on click - #578
Open
sandesh-sp wants to merge 4 commits into
Open
sandesh-sp wants to merge 4 commits into
sandesh-sp wants to merge 4 commits into
Conversation
8 tasks
sandesh-sp
changed the base branch from
development
to
feature/570-float-bottom-offset
October 15, 2026 21:37
sandesh-sp
force-pushed
the
feature/570-float-bottom-offset
branch
from
October 16, 2026 13:26
338b43a to
a24c795
Compare
map:getViewState carries the camera's bearing and pitch. deck.gl reads them from its camera; Leaflet reports pitch 0 and the bearing its projection gives at the map centre, so a polar map reports where north is. map:resetNorth eases a rotated deck.gl view back to north while keeping its tilt, and a north-up view back to flat. Leaflet cannot rotate, so it returns false and leaves the view alone.
…view on click A compass button beside the zoom buttons, behind a Compass checkbox that is on by default. Its needle turns against the map's bearing and tips with its tilt, following the camera on map:moveend and once per frame during map:move. Hovering shows the bearing and tilt; clicking asks the map to reset toward north.
Both halves of the needle take currentColor like the bar's other glyphs, with the south half faded so north still reads first. The needle is drawn at 20px against the other glyphs' 16px.
- deck.gl emits move on each basemap and side-by-side pane frame, so the needle follows gestures and the reset ease - resetNorth turns the short way to the nearest whole turn, and in overlay mode decides from the live basemap camera - Core provides map:getCamera and emits map:ready on each map init; the compass reads through them, at most once per frame - getViewState leaves bearing and pitch null when the engine throws - On an engine that cannot rotate the compass is an indicator, not a reset button
sandesh-sp
force-pushed
the
feature/576-map-control-compass
branch
from
October 20, 2026 14:17
53f87c0 to
1b14641
Compare
sandesh-sp
changed the base branch from
feature/570-float-bottom-offset
to
development
October 20, 2026 14:17
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 #576.
Summary
map:getViewStatenow includesbearingandpitch. deck.gl reads both from its camera. Leaflet always reports pitch 0 and reports the bearing its projection gives at the map centre, so polar maps show where north is.map:resetNorth. On a rotated deck.gl view, it eases back to north and keeps the tilt. On a view that already faces north, it flattens the tilt. Leaflet can't rotate, so it returnsfalseand leaves the view alone.showCompass) that is on by default. The needle turns against the bearing and tips with the pitch. It updates onmap:moveend, and duringmap:moveit reads the camera at most once per animation frame. Hovering shows the bearing and tilt, and clicking resets the view toward north.Test plan
npx vitest run: 211 files, 3,610 tests pass