You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ScrollViewer wheel notch distance and motion differ from WinUI #24733
A wheel notch on the legacy ScrollViewer scrolls Max(48, Round(0.15 × viewport)) DIP (the non-DirectManipulation fallback), so viewports under 320 DIP scroll up to 3× too far. Each notch also restarts a 1 s Power(Out, 10) animation, so wheel scrolling is slow to settle (~1 s) and its speed jumps on every notch.
Expected behavior 🎯
Match WinUI 3's ScrollViewer, measured frame by frame: 15% of the viewport × delta/120 per notch with no floor, and a ~220 ms ease-out per notch (about 22% on the first frame, then quadratic), retargeting on each notch: 50% of the distance in ~47 ms, 90% in ~145 ms.
How to reproduce it (as minimally and precisely as possible) 🔬
Scroll a small ScrollViewer (e.g. 100 DIP tall) with a mouse wheel next to WinUI 3.
Two more differences in the same helpers, found by comparing GetVerticalScrollWheelDelta / GetHorizontalScrollWheelDelta (ScrollContentPresenter.mux.cs#L24-L27) with WinUI's GetVertical/HorizontalScrollWheelDelta macros (ScrollViewer_Partial.h). Confirmed by code inspection against the WinUI C++ sources, not by a runtime run:
Rounding: Uno uses Math.Round(x, 0) (midpoint to even). WinUI's DoubleUtil::Round is Floor(x/scale + 0.5) * scale (midpoint up). E.g. a 350 DIP viewport gives 52.5, which is 53 in WinUI and 52 in Uno.
Negative deltas are never clamped to the viewport: WinUI always passes a positive magnitude and applies the sign at the call site (MouseWheelUp/Down), so Min(Floor(size), d) limits both directions. Uno passes the signed delta (-delta, ScrollContentPresenter.cs#L310), so a negative distance bypasses the clamp: a 100 DIP viewport with a +1200 delta scrolls 480 px one way, while the other direction is limited to 100.
Both go away if the macros are replaced as in #24740 (no rounding, symmetric clamp), so this is just a note for that review.
Activity
MartinZikmund commentedon Oct 12, 2026
Two more differences in the same helpers, found by comparing
GetVerticalScrollWheelDelta/GetHorizontalScrollWheelDelta(ScrollContentPresenter.mux.cs#L24-L27) with WinUI'sGetVertical/HorizontalScrollWheelDeltamacros (ScrollViewer_Partial.h). Confirmed by code inspection against the WinUI C++ sources, not by a runtime run:Math.Round(x, 0)(midpoint to even). WinUI'sDoubleUtil::RoundisFloor(x/scale + 0.5) * scale(midpoint up). E.g. a 350 DIP viewport gives 52.5, which is 53 in WinUI and 52 in Uno.MouseWheelUp/Down), soMin(Floor(size), d)limits both directions. Uno passes the signed delta (-delta, ScrollContentPresenter.cs#L310), so a negative distance bypasses the clamp: a 100 DIP viewport with a +1200 delta scrolls 480 px one way, while the other direction is limited to 100.Both go away if the macros are replaced as in #24740 (no rounding, symmetric clamp), so this is just a note for that review.