Repository navigation
feat(whiteboard): mouse wheel scrolls instead of zooming (use ctrl to zoom) - #25527
Conversation
Modifies the tldraw mouse wheel behavior so scrolling the wheel pans the presentation, and holding ctrl (or cmd) while scrolling zooms in/out. This provides a more consistent and intuitive navigation experience for users.
|
Thank you for this contribution! |
WalkthroughWhiteboard wheel handling now supports two modes: Ctrl/Cmd-modified wheel movement adjusts cursor-anchored zoom and backend zoom percentage, while unmodified wheel movement vertically pans the camera using the current zoom factor without changing zoom. Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
I have already signed and emailed the Contributor License Agreement for my previous PR. |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@bigbluebutton-html5/imports/ui/components/whiteboard/hooks.js`:
- Around line 228-229: Update the zoom modifier check in the wheel-event handler
around event.ctrlKey and event.metaKey to use only the platform-appropriate key:
metaKey on macOS and ctrlKey on Windows/Linux. Ensure the non-platform modifier
is ignored so accidental zooming cannot occur.
- Around line 261-265: Update the vertical pan calculation in the wheel-handling
hook by removing the negation from the deltaY-based panAmount expression.
Preserve the existing panFactor and cz scaling so positive deltaY increases cy
and moves the presentation downward.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 9e9e12f7-7dcc-49ab-880f-0efda66d2705
📒 Files selected for processing (1)
bigbluebutton-html5/imports/ui/components/whiteboard/hooks.js
| // Check if user wants to zoom (Ctrl/Cmd key pressed) | ||
| if (event.ctrlKey || event.metaKey) { |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Use the platform-specific zoom modifier.
This allows Ctrl+wheel on macOS and Meta+wheel on Windows/Linux, contrary to the stated Cmd-on-macOS / Ctrl-elsewhere behavior. Ctrl+wheel on macOS can therefore still trigger accidental zooming.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@bigbluebutton-html5/imports/ui/components/whiteboard/hooks.js` around lines
228 - 229, Update the zoom modifier check in the wheel-event handler around
event.ctrlKey and event.metaKey to use only the platform-appropriate key:
metaKey on macOS and ctrlKey on Windows/Linux. Ensure the non-platform modifier
is ignored so accidental zooming cannot occur.
| const panAmount = -(event.deltaY * panFactor) / cz; | ||
|
|
||
| const nextCamera = { | ||
| x: cx, | ||
| y: cy + panAmount, |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Fix the inverted vertical pan direction.
For a positive deltaY (scroll down), negating panAmount decreases cy, moving the viewport upward. Remove the negation so normal scrolling moves the presentation downward.
Proposed fix
- const panAmount = -(event.deltaY * panFactor) / cz;
+ const panAmount = (event.deltaY * panFactor) / cz;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const panAmount = -(event.deltaY * panFactor) / cz; | |
| const nextCamera = { | |
| x: cx, | |
| y: cy + panAmount, | |
| const panAmount = (event.deltaY * panFactor) / cz; | |
| const nextCamera = { | |
| x: cx, | |
| y: cy + panAmount, |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@bigbluebutton-html5/imports/ui/components/whiteboard/hooks.js` around lines
261 - 265, Update the vertical pan calculation in the wheel-handling hook by
removing the negation from the deltaY-based panAmount expression. Preserve the
existing panFactor and cz scaling so positive deltaY increases cy and moves the
presentation downward.
BBB 4.0 changed the presenter mouse wheel over the presentation from zooming to vertical scrolling, with Ctrl/Cmd + wheel to zoom (#25527). Deployments whose users rely on the long-standing zoom-by-wheel navigation (unchanged for many years before 4.0) asked for a way to keep it, especially where portrait slides that benefit from scrolling are rare. Add public.whiteboard.wheelZoomRequiresCtrl: - true (default): wheel scrolls the slide, Ctrl/Cmd + wheel zooms (the 4.0 behavior, unchanged) - false: wheel zooms directly, as in BBB 3.0 and earlier The fallback to true in hooks.js covers clients briefly served a settings payload predating this key during rolling upgrades.
This pull request modifies the tldraw mouse wheel behavior in the presentation area.
Features added:
Benefits:
This provides a more consistent, intuitive, and standard navigation experience (similar to most document viewers and map applications) and prevents accidental zooming when a user simply intends to scroll the page.