Repository navigation
[3.0 WB] fix viewer's unfaithful slide position by panning - #25691
hiroshisuga wants to merge 3 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. WalkthroughThe Priority: ➖ Normal Estimated code review effort: 1 (Trivial) | ~3 minutes Change: Bug fix · Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The zoom conversion is consistent across the synchronization path and introduces no merge-blocking risk. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Linked Issues checkExplanation The linked issue requires a correction to the presentation camera-following behavior [
✨ 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 |
imdt-claudiop
left a comment
There was a problem hiding this comment.
I tested this on a from-source 3.0 environment (this PR applied on top of the current v3.0.x-develop tip, conflict-free) with a presenter + viewer Playwright matrix: zoom levels 100/150/200%, pan, panels visible/hidden, and window resize, reading the tldraw camera numerically on both sides and cross-checking with screenshots.
Results:
- On base (
v3.0.x-developtip), viewer camera tracked the presenter within 0.05px in all 7 scenarios - I could not reproduce the unfaithful viewer position this PR describes. - On this PR, two scenarios fail reproducibly: with the chat and user-list panels hidden (slide letterboxed,
widthGap > 0), after the presenter zooms and pans, the viewer never receives the zoom or the pan and stays on the pristine camera. Base handles the identical scenario correctly.
Root cause is detailed in the inline comment: the rounding change is inverted for the one-sided drift that the gap calculation produces, so the zoomSlide() broadcast gate never matches.
Comparison video (base on top / PR below, presenter + viewer side by side): https://claudio.sfo3.digitaloceanspaces.com/work-evidences/2026-09-08/9e1d6f85-c031-4e9b-8dd4-3d7a0ce55505/COMPARISON-base-vs-PR25691.mp4
Isolated regression (PR build, panels hidden, zoom 200% + pan): https://claudio.sfo3.digitaloceanspaces.com/work-evidences/2026-09-08/aeeb329c-5c10-45d5-80eb-5bee45e78dec/PR25691-regression-S2-gap-z200.mp4
Since I could not reproduce the original issue on base, could you share the repro configuration for the unfaithful position? If the reported case has the computed percent landing above the nominal zoom, truncation would help there - but for the gap configurations I tested the drift is always negative, where Math.round is the more tolerant direction.
| ); | ||
| const tlCamPercent = Math.round( | ||
| (nextCam.z / (initialZoomRef.current || 1)) * 100 | ||
| const tlCamPercent = parseInt( |
There was a problem hiding this comment.
This truncation breaks the broadcast gate whenever widthGap > 0 (slide letterboxed by hidden panels).
In that case syncCameraOnPresenterZoom sets the camera from calculateZoomWithGapValue(), which subtracts the gap from the available width, while tlCamPercent divides by initialZoomRef.current (no gap subtraction). The computed percent therefore lands slightly below the nominal zoom. Since the gap can only ever subtract width, this drift is one-sided (always negative):
Math.roundrounds the percent back up to the nominal value, sotlCamPercent === zoomValueRef.currentholds andzoomSlide()publishes the viewed region.parseInttruncates down, the equality never matches, and the viewer's camera sync never fires at all (not just the pan - the viewer misses the zoom too).
Repro (PR build): presenter zooms to 200% and pans with chat + user-list hidden (widthGap = 337px on a 1280px viewport) - viewer stays at the pristine camera (z=0.70, x=y=-0.57) while the presenter is at x=-528.87, y=-302.22. Base in the identical scenario tracks within 0.05px.
For parseInt to be the correct fix, the drift would have to be positive; I could not produce a configuration where it is.
|
@imdt-claudiop , I will take a look. Thanks! |
|
Hi @imdt-claudiop , thanks for the review and testing. I completely missed the case that widthGap is positive. On a fresh installation of 3.0.37, I was able to reproduce both the issue I reported and the regression you found (widthGap > 0). See also the movie that I obtained at the official demo site (3.0.35): #25690. First, my original issue is reproducible when the zoom value has a fractional part for which parseInt() and Math.round() produce different integers, such as 200.59%. I could not reproduce it when, for instance, zoom level is exactly 150%, 200%, 250%...etc, as you (perhaps) tested. I logged the zoom metrics with the following code: -> then print the "zoomDebug" after 300 ms using setTimeout. After the tlCamPercent calculation in component.jsx of the whiteboard: -> this I also wrapped by setTimeout (300ms) just in case. Then I zoom by wheel and pan by dragging the presentation. After a couple of operations, I got this: And the slide position mismatches between the presenter and the viewer: Next I hid the chat and user-list panes and got this: The slide position mismatches again: Finally I tried to reproduce the condition you tested as much as possible, like: , and I got this: In this case, not surprisingly, the slide pan position perfectly matches between the presenter and the viewer because I did not touch the code. Obviously I will get the problem immediately when the Math.round -> parseInt change is applied at the tlCamPercent calculation (the regression that you found). These results suggest what to change is not the Math.round at tlCamPercent calculation, but the parseInt at boundZoom calculation. Based on this assumption, I reverted the tlCamPercent calculation modifiication and changed the parseInt to Math.round at boundZoom calculation. So far, I have not been able to reproduce either problem. |
✅ Automated tests have passed! |
|
hello @imdt-claudiop - can you review it again, considering this last comment? |
|
Thanks for the detailed instrumentation, @hiroshisuga. It settles this: your conclusion is correct, and the current head ( Why fractional zoom breaks the pan sync on base
Why the fix is on the
Rounding the stored zoom the same way means both sides round the same value:
Suggestions
Known limitation (unchanged): if From a code-path review, this looks correct to me, and it fixes the case your data shows. |
The two-finger gestures are sent with CDP Input.dispatchTouchEvent from a touch-enabled desktop context, so the client gets trusted touch and pointer events as on a tablet while keeping the desktop layout and zoom toolbar; Chromium only. Cameras are read through the tldraw editor, the per-frame zoom from the html layer's transform. They check that a pinch in at 100 % stays at 100 % for everyone, that a quick pinch out and a pinch past 400 % end with the viewer on the presenter's view at no more than 400 %, that a slow pinch out is published and keeps the point between the fingers under them, that the zoom of presenter and viewer only moves in the pinch direction, that a two-finger pan reaches viewers, that a viewer pinch moves no camera, that a whiteboard user's two-finger tap undoes their last action and keeps the pencil, and that the fingers leave no stroke behind. On 4.0.x-develop the pinch-in, slow-pinch, flicker and two-finger-tap tests fail; with #25671 and #25691 the pinch-in test passes and the other three still fail. Refs #26079


What does this PR do?
This PR changes the calculation of tlCamPercent from Math.round() to parseInt() so that it uses the same integer conversion as BBB's zoomValue.This PR changes the calculation of boundZoom in zoomChanger() at whiteboard from parseInt() to Math.round() so that it uses the same integer conversion as tldraw's zoom-level value.
This prevents valid pan updates from being rejected when the tldraw camera zoom contains a fractional value.
Closes Issue(s)
Closes #25690 (fixes only the pan problem, but not the cursor position delay)
Motivation
BBB stores the presentation zoom percentage using
parseInt(), whiletlCamPercent, which is derived from the tldraw camera, was calculated usingMath.round().(seebigbluebutton/bigbluebutton-html5/imports/ui/components/presentation/component.jsx
Line 470 in f42351e
Because of this difference, the two values could differ by 1 even though they represented the same zoom level. For example in my investigation:
actually happened.
The camera synchronization check requires these values to match before publishing pan updates. When they differed, valid pan updates were skipped, causing the presenter's and viewers' camera positions to become desynchronized. Changing the zoom level would usually synchronize them again.
Using the same integer conversion on both sides keeps the existing synchronization logic while avoiding this false mismatch.
How to test
More