Repository navigation
fix(maplibre): keep picking in sync with the terrain elevation - #10756
Merged
Merged
Conversation
|
chrisgervang
approved these changes
Sep 30, 2026
chrisgervang
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for the bug fix, and the helpful jsbin!
53 of 66 tasks
chrisgervang
pushed a commit
that referenced
this pull request
Oct 22, 2026
(cherry picked from commit ce0808d)
This was referenced Oct 26, 2026
Collaborator
|
Released in deck.gl 9.4.1. Thanks @birkskyum! |
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.
Background
Right now picking in interleaved mode uses the view state that
MapLibreOverlayupdates on MapLibre'smoveevents, while drawing reads the camera from the map every frame. MapLibre raises the center elevation while the terrain tiles load without amoveevent, so picks over terrain miss until the map moves.Change List
MapLibreOverlay: refresh the view state when the center elevation changesCan be tested here, hover the summits right after the page loads:
Left - deck.gl 9.4.0 / Right - This PR
https://jsbin.com/demexeg/edit?output
Note
Medium Risk
Touches the interleaved render loop and view-state updates on every frame when terrain elevation changes; limited to MapLibre overlay sync but affects picking correctness.
Overview
Fixes interleaved
MapLibreOverlaypicking drifting from the map while terrain loads: MapLibre can update center elevation on each frame without amoveevent, but deck’s storedviewStatewas only refreshed on move.On MapLibre’s
renderhook, the overlay now callssyncMapLibreElevation, which compares the map’s center elevation toviewState.position[2]and re-syncs viaonMapLibreMovewhen they differ so picking uses the same camera as drawing.Adds WebGL regression tests (MapLibre 4.5.1, 5.0.0, 6.0.0) with a synthetic raster-DEM tile,
setTerrain, and assertsviewState.positionandpickObjecthit a 3D scatter point at the summit.Reviewed by Cursor Bugbot for commit e70cce3. Bugbot is set up for automated code reviews on this repo. Configure here.