feat(core): 3D enable MapController using new rotatePivot option#9938
Open
felixpalmer wants to merge 19 commits intomasterfrom
Open
feat(core): 3D enable MapController using new rotatePivot option#9938felixpalmer wants to merge 19 commits intomasterfrom
felixpalmer wants to merge 19 commits intomasterfrom
Conversation
felixpalmer
commented
Jan 15, 2026
|
|
||
| import {Deck} from '@deck.gl/core'; | ||
| import {Tile3DLayer} from '@deck.gl/geo-layers'; | ||
| import {ScenegraphLayer} from '@deck.gl/mesh-layers'; |
Collaborator
Author
There was a problem hiding this comment.
Test app for demo only, will not be commiting
Collaborator
There was a problem hiding this comment.
the layers all have a nice mdx pattern of rendering sample data and interactivity - should we consider doing the same per controller? Theres over 5 controllers now.
Comment on lines
-205
to
+220
| rotateStart({pos}: {pos: [number, number]}): MapState { | ||
| rotateStart({pos, altitude}: {pos: [number, number]; altitude?: number}): MapState { |
Collaborator
There was a problem hiding this comment.
Some APIs use a 3d position, some are split like this.. isn't it better to be consistent?
panByPosition3D uses a 3d position
Collaborator
There was a problem hiding this comment.
I recall doing a update to the view state.position to add a 3rd value to all of these before.
I still question if that would be cleaner.
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
Building on top of the 3D picking infrastructure in #9937
MapControllerzooms to the position of the cursor, but when a rotation/tilt is triggered using the Shift Key, the center is always fixed at the center of the viewport, with z=0.For flat scenes this works OK, but when we are using a layer that has some non-zero elevation, for example
TerrainLayerorTile3DLayerthe movement feels unnatural.This PR adds a new prop to the
MapController:rotationPivot: 'center' | '2d' | '3d'which means the rotate/tilt operation is anchored on:'center': Center of viewport, with z=0 irrespective of mouse position (current behavior)'2d': Mouse position, with z=0'3d': Mouse position, with z raycast onto sceneThe following videos demonstrate the behavior:
Mouse grabbed in bottom left corner, but pivot is in center of screen:
Screen.Recording.2026-01-15.at.16.01.09.mov
Pivot is now correctly at mouse location, but behind building as z=0 is assumed
Screen.Recording.2026-01-15.at.16.01.29.mov
Pivot is now on front side of the building
Screen.Recording.2026-01-15.at.16.01.48.mov
Works even with multiple layers, why not pivot on planes in the sky!
Screen.Recording.2026-01-15.at.16.02.16.mov
Change List
rotationPivotpropMapController_pickPositionForControllertoDeckto provide way forMapControllerto access pickingrotationPivotPositioninInteractionStateto enable drawing helper layer showing pivot locationLimitations