Skip to content

Add mouse wheel scaling for ModelViewers in the simulator - #437

Merged
dli7319 merged 1 commit into
google:mainfrom
Yong-yuan-X:agent/issue-428-simulator-wheel-zoom
Jul 17, 2026
Merged

Add mouse wheel scaling for ModelViewers in the simulator#437
dli7319 merged 1 commit into
google:mainfrom
Yong-yuan-X:agent/issue-428-simulator-wheel-zoom

Conversation

@Yong-yuan-X

@Yong-yuan-X Yong-yuan-X commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Scale the ModelViewer under the mouse pointer with the wheel in simulator User mode.
  • Apply uniform model scaling as a desktop equivalent of the existing two-hand pinch gesture.
  • Normalize pixel-, line-, and page-based wheel deltas.
  • Preserve browser scrolling when no scalable ModelViewer is targeted.
  • Update the simulator instructions and manual to describe the new control.
  • Add tests for model targeting, scaling direction, delta normalization, and wheel event handling.

Motivation

The simulator did not provide a mouse-based equivalent of the two-hand pinch gesture used to scale ModelViewer objects.

Mouse wheel input should change the targeted model's scale without moving the simulator camera or changing the user's viewport.

Testing

  • npm run test — 58 test files and 493 tests passed on Node.js 24
  • npm run lint
  • npm run format:check
  • npm run build
  • cd docs && npm run build

Closes #428

@dli7319

dli7319 commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

This actually moves the simulator camera forwards and backwards.

@ruofeidu Is this what you had in mind?
#428 sounds like it should scale up and scale down 3D models.

@ruofeidu

Copy link
Copy Markdown
Collaborator

Hi Yong-yuan,

For XR, user's viewport is fixed by device... so we likely don't want to mount mouse wheels to camera forwards and backwards, can you make it apply to two-hands-pinch-zoom in and zoom out? Thanks!

@ruofeidu ruofeidu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Change mouse wheel to scale ModelViewers.

@Yong-yuan-X

Copy link
Copy Markdown
Contributor Author

@ruofeidu Sry, I misunderstood the intended behavior.

I’ll update the implementation so the mouse wheel scales the ModelViewer under the pointer, matching the existing two-hand pinch scaling interaction. I’ll remove the camera movement and navmesh-related changes, update the tests and documentation, and push the revised implementation to this PR.

@Yong-yuan-X
Yong-yuan-X force-pushed the agent/issue-428-simulator-wheel-zoom branch from 9fd70a2 to d8a17c2 Compare July 16, 2026 06:18
@Yong-yuan-X
Yong-yuan-X requested a review from ruofeidu July 16, 2026 06:20
@Yong-yuan-X Yong-yuan-X changed the title Add mouse wheel zoom controls to the simulator Add mouse wheel scaling for ModelViewers in the simulator Jul 16, 2026

@dli7319 dli7319 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Awesome, Thanks!

@dli7319
dli7319 force-pushed the agent/issue-428-simulator-wheel-zoom branch from d8a17c2 to 4add933 Compare July 17, 2026 16:37
@dli7319
dli7319 merged commit a57e841 into google:main Jul 17, 2026
10 checks passed
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.

[Good for first contributors] Scrolling for zooming in & out models in simulator

3 participants