Skip to content

Conversation

@felixpalmer
Copy link
Collaborator

@felixpalmer felixpalmer commented Jan 15, 2026

Background

Building on top of the 3D picking infrastructure in #9937

MapController zooms 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 TerrainLayer or Tile3DLayer the 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 scene

The 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

  • Add the rotationPivot prop
  • Update input handling in MapController
  • Add _pickPositionForController to Deck to provide way for MapController to access picking
  • Expose rotationPivotPosition in InteractionState to enable drawing helper layer showing pivot location

Limitations

  • Not yet working well with TerrainExtension


import {Deck} from '@deck.gl/core';
import {Tile3DLayer} from '@deck.gl/geo-layers';
import {ScenegraphLayer} from '@deck.gl/mesh-layers';
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test app for demo only, will not be commiting

Base automatically changed from felix/3d-picking to master January 30, 2026 10:34
@chrisgervang chrisgervang added this to the v9.3 milestone Feb 2, 2026
@chrisgervang chrisgervang mentioned this pull request Feb 3, 2026
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants