Skip to content

perf(scrollviewer): Drive fling and wheel motion per frame - #24739

Merged
MartinZikmund merged 41 commits into
masterfrom
dev/mazi/scroll-motion
Oct 10, 2026
Merged

MartinZikmund merged 41 commits into
masterfrom
dev/mazi/scroll-motion

Conversation

@MartinZikmund

@MartinZikmund MartinZikmund commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

GitHub Issue: closes #23985

Stacked PR. Base: master (#24738 has merged). Followed by #24740 (WinUI wheel curve), which is stacked on this branch.

PR Type:

🐞 Bugfix

What changed? 🚀

Legacy ScrollViewer motion rework:

  • Unquantized direct-manipulation deltas: slow touch drags no longer move in ≥2 px jumps.

  • Fling launch velocity from a least-squares ScrollVelocityTracker; closed-form fling curves matching the host platform:

    • Android, Windows and Linux follow AOSP OverScroller's actual spline (SPLINE_POSITION Bézier, getSplineFlingDuration / getSplineFlingDistance), solved exactly so the fling leaves at its launch velocity. On Android (and Android browsers) the physical coefficient uses 160 logical px per inch, since Uno's logical pixel is a dp there; elsewhere a 1/96 in DIP.
    • Apple platforms and WASM in iOS browsers follow UIScrollView's deceleration.
  • The release's own movement is applied before the fling starts (the recognizer commits it without an Updated event).

  • Wheel/touchpad motion driven per frame; each notch adds to the motion instead of restarting a 1 s ease (curve itself replaced in fix(scrollviewer): Scroll by wheel like WinUI #24740). A notch during an animated ChangeView continues from where the content is drawn, a notch too fine to move a pixel no longer chains to a parent, and unloading mid-decay publishes the final offset.

  • Animated ChangeView matches WinUI's ScrollViewer, measured on WinUI 1.8 with a throwaway oracle app (its animation lives in DirectManipulation, not in the XAML sources): 1.4 ms per physical pixel within [175, 475] ms (fit over 90 runs at 100 % and 250 % scale, rms 5.7 ms), on a curve a quartic ease-out fits as well as any tested one. The final ViewChanged reports the exact target.

  • CI fix — offset intent clamped at request time, as WinUI does (SetVerticalOffsetPrivate / AdjustTargetVerticalOffset, with the target zoom). The intent used to keep the raw request, so ChangeView(null, 10000) on an incrementally loading list kept re-seating the offset to each new end and loading batch after batch until it reached 10000. That made Given_ListViewBase.When_Incremental_Load_Default fail on the desktop legs. The bug is latent on master; this PR's timing exposed it. The oracle confirms WinUI keeps the request-time clamp when the extent grows, and drops a ChangeView issued before layout. ListView's own layout compensation keeps the raw intent (its extent runs ahead of the ScrollViewer's), and Hot Reload's offset restore waits for the layout to fit the saved offset.

  • A fling launches only from the gesture's own motion. It doesn't move along an axis the drag was railed to (or one this presenter can't scroll); before, a near-vertical flick drifted 283 px sideways. A finger that rested before lifting no longer flings at its earlier drag speed. As in Android's VelocityTracker, the release is not fitted as a sample: it repeats the last move's position, and fitting it shrank the velocity or even reversed a short flick (a flick after several the other way could coast back the original way). Only its time counts: a release more than 40 ms after the last move reports zero velocity. Synthetic flicks at -2 px/ms released 2/6/12 ms after the last move gave -1.75/-1.11/-0.35 before and -2.00 after; a short 3-move flick gave +0.21 (reversed) before and -2.75 after. Confirmed on a Galaxy Z Fold7.

  • The wheel decay lands exactly on the sum of its notches: it projected position + velocity / λ, which drifts in floating point, so five 4 px notches came to rest on 19.999999999999996 and the end of an 80 px extent on 79.99999999999999 (When_Nested_ScrollViewers_WheelChanged failed on the desktop legs, masked by retries). fix(scrollviewer): Scroll by wheel like WinUI #24740's wheel curve already keeps an exact target.

  • A scroll animation replaced by another motion (wheel, touch, another ChangeView) no longer reports a final ViewChanged in the middle of that motion.

  • ScrollViewer.IsInManipulation covers the presenter-driven touch manipulation, fling, snap and animated scrolls, as WinUI's DirectManipulation state does. FlipView's FixOffset waits on it; before, it could fire mid-snap and pull the view back to the previous item.

  • CalendarView's scroll-into-view uses the panel's own estimated extent, so it keeps the raw intent like ListView's layout compensation.

Evidence (Win32 119 Hz, probe medians of 3 interleaved pairs, with the layers below): ScrollViewer wheel-burst newFps 90 → 120, judder 3.0 → 0.7 px; touchpad 89 → 120; repeated presents ~35 → 0. iPhone 13 Pro 120 Hz touch-drag max step 48 → 9 px after the frame-clock fixes.

These numbers were measured with the frame-time grid, which has since been split out of #24735 into #24966 (on top of this stack). Without it, frame times are the raw clock sampled once per frame, so judder can be somewhat higher until #24966 or native vsync timestamps (#24963) land. That is still no worse than master, which has neither.

When_Incremental_Load_Default with the process pinned to one core, to mimic CI agents: about 50 % failures before, 5/5 runs green after (with When_Incremental_Load_ShouldStop).

Tests (Unit): Given_ScrollVelocityTracker covers release timing: a release shortly after the last move keeps the motion's slope and direction, a late one reports zero.

Tests (Runtime): wheel notches land on whole pixels, railed flick stays on its axis, rested finger doesn't fling, one final ViewChanged when the wheel takes over an animation, fling distance, unload mid-fling, slow drag, 5 notches → one final ViewChanged, OverScroller spline (against AOSP's own SPLINE_POSITION loop), release delta, ChangeView past the extent (WinUI-verified), fine wheel delta not chaining, wheel during an animated ChangeView, unload mid-decay, ChangeView easing and duration, final offset. The new ones fail on the source before their fix (the short-hop duration and final-offset tests are parity checks that also pass there).

Measured with the scroll-smoothness probe from #24711 (sample=Scrolling/ScrollSmoothnessTester&scrollprobe=...). newFps = presented frames showing a newly recorded frame per second; judder = RMS residual of the offset against a local quadratic through neighbouring presented frames.

Local runs (Skia Win32, 250 % scale): Given_ScrollViewer, Given_ScrollViewer_Zoom, Given_ItemsRepeater* all green; Given_ListViewBase failures are the pre-existing 250 %-scale ones, identical on the base commit. Uno.UI.UnitTests: only the 12 known timezone-dependent Gregorian_FixedDate failures.

Given_FlipView.When_TouchFlick_Then_FlipOneItem was flaky on master too (CI hid it with retries). With retries off and one core it failed about 20% of iterations on master. It had two causes:

  • The animated scroll's in-progress check read the animation's wall-clock Remaining, which reaches zero before a late last frame publishes the final offsets. IsInManipulation now holds until the animation has stopped (When_ChangeView_Animated_Then_In_Motion_Until_Final_ViewChanged).
  • The test flicked while FlipView's load-time FixOffset tick was still pending. That tick postpones itself to the end of the manipulation, then suppresses the snap's selection change and scrolls back. WinUI's FlipView_Partial.cpp behaves the same way, so the test now waits for the pending fix first.

With both changes the test passes 60/60 and 40/40 iterations with retries off on one core. Measured with #25153, which adds --runtime-tests-iterations / --runtime-tests-attempts to the runner.

PR Checklist ✅

🤖 Generated with Claude Code

https://claude.ai/code/session_01Usdq5JJfVkzKcYtwkKCRUy

@github-actions

github-actions Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 6m 51s —— View job


Review complete

  • Gather context (diff vs origin/dev/mazi/scrollview-wheel-parity, read changed files)
  • Review ScrollVelocityTracker.cs (new)
  • Review ScrollDecaySimulation.cs / ScrollFlingSimulation.cs (new)
  • Review ScrollContentPresenter.Managed.cs changes
  • Review GestureRecognizer* changes
  • Review DirectManipulation.cs / IDirectManipulationHandler.cs
  • Review runtime tests in Given_ScrollViewer.cs
  • Post inline findings
  • Post summary

Verdict: fix-first (no blocking correctness bugs found; two non-blocking findings posted inline).

Findings (2, both minor/moderate, both on ScrollVelocityTracker.cs):

  1. Build-hygiene: the file's placement under src/Uno.UI/UI/Input/WinRT/ gets it wildcard-compiled into all four Uno.WinRT.*.csproj variants (Skia/Reference/Wasm/netcoremobile) as unreferenced internal code, unlike its sibling helpers (ScrollDecaySimulation, ScrollFlingSimulation) which correctly live under a Uno.UI-exclusive folder.
  2. Test-coverage gap: the Gram-Schmidt QR least-squares velocity fit — the numerical core of the new fling behavior — has no direct unit test, only an indirect, loosely-bounded runtime test.

What held up well under review:

  • The manipulation/inertia hand-off (_touchInertia kept alive as a "coast holder" while the actual motion is driven by ScrollFlingSimulation/ScrollDecaySimulation off the frame clock, OnInertiaInterrupted for press-to-stop, CompleteTouchInertia() ordering) is internally consistent — traced through DirectManipulation.TryProcessDown, GestureRecognizer.Manipulation, and the InertiaProcessor's own deceleration math, including the non-obvious self-consistency between the fitted fling duration and the DesiredDisplacementDeceleration used to keep the recognizer's own processor alive exactly as long as needed.
  • No banned event Action<T>, .Result/.GetAwaiter().GetResult(), or async void patterns introduced.
  • Frame-driver subscribe/unsubscribe (Media.CompositionTarget.FrameStarting) is symmetric and covered by a dedicated unload-mid-fling test.
  • No skipped/[Ignore]d or Assert.Inconclusive tests introduced beyond the pre-existing platform-conditioned patterns already used throughout this file.
  • ScrollFlingSimulation/ScrollDecaySimulation are allocation-free value types on the per-frame hot path.
    · branch

@github-actions

github-actions Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 4m 12s —— View job


Review complete

  • Gather context (diff vs origin/dev/mazi/scrollview-wheel-parity; confirmed this synchronize only added 4 commits since the last review — fix(scrollviewer): Ease animated ChangeView like ScrollPresenter, its test, fix(scrollviewer): Publish the target as an animated scroll's final offset, and its test — touching only ScrollContentPresenter.Managed.cs and Given_ScrollViewer.cs)
  • Review new files: ScrollVelocityTracker.cs, ScrollDecaySimulation.cs, ScrollFlingSimulation.cs (unchanged since last review)
  • Review ScrollContentPresenter.Managed.cs / .cs changes (new: composition-default easing swap, Progress-gated final-offset publish)
  • Review GestureRecognizer* changes (unchanged since last review)
  • Review DirectManipulation.cs / IDirectManipulationHandler.cs (unchanged since last review)
  • Review runtime tests in Given_ScrollViewer.cs (new tests for the easing/final-offset fixes)
  • Post inline findings
  • Post summary

Verdict: fix-first — one new blocking-on-principle finding, everything else clean.

Findings this pass: 1 (moderate).

  • Given_ScrollViewer.cs: the two new tests (When_ChangeView_Animated_Then_Eases_Like_ScrollPresenter, When_ChangeView_Animated_Then_Final_Offset_Is_The_Target) wrap the whole [TestMethod] in #if __SKIA__/#endif, which per .claude/rules/runtime-tests.md compiles fine but breaks test discovery — and, since these are WinUI-parity assertions (easing curve, final-offset semantics), it also means they can never actually run against native WinUI to prove the parity the PR targets. This file already has the right pattern in >10 other places ([PlatformCondition(ConditionMode.Exclude, RuntimeTestPlatforms.NativeWinUI)]).

What held up well in the new commits:

  • Swapping Power(Out, 10) for Compositor.GetDefaultEasingFunction() reuses the same helper Vector2/3/4KeyFrameAnimation already default to elsewhere — no new easing implementation, verified the symbol resolves in Uno.UI.Composition/Compositor.cs.
  • The distance-scaled duration reuses the existing ScrollPresenter.s_offsetsChange{MsPerUnit,MinMs,MaxMs} constants rather than re-declaring magic numbers.
  • The scrollAnimation.Progress >= 1 branch is a real root-cause fix, not a guard: KeyFrameEvaluator.GetCurrentProgress() only returns exactly 1.0f when the playhead has clamped to the full iteration count (natural completion), and stays < 1 on an externally-interrupted animation — so publishing the exact double-precision target instead of round-tripping through the single-precision Vector2 AnchorPoint is well-founded, and won't misfire on interruption.

Still open from the earlier review (files unchanged by this update, so not re-flagged inline to avoid duplicates):

  • ScrollVelocityTracker.cs still lives under src/Uno.UI/UI/Input/WinRT/, so it's still wildcard-compiled into all four Uno.WinRT.*.csproj variants as dead code — should move under ScrollContentPresenter/ alongside its sibling simulations.
  • The Gram-Schmidt QR least-squares fit in ScrollVelocityTracker.SolveSlope still has no direct unit test, only the loosely-bounded runtime test.
  • The github-code-quality bot's floating-point-equality flags (_velocity != 0 in ScrollDecaySimulation/ScrollFlingSimulation) are not a real bug here — every code path that clears _velocity does so via an explicit = 0 literal assignment (not a computed value expected to converge to zero), so the equality check reliably detects "explicitly stopped" state.
    · branch

Copilot AI balanced review requested due to automatic review settings October 2, 2026 10:28
@github-actions github-actions Bot added the area/automation Categorizes an issue or PR as relevant to project automation label Oct 2, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Motion can drop release deltas and final notifications, while precision-wheel and platform-parity goals remain incomplete.

Review effort: Balanced
Findings: 4 Medium severity

Open (4)
What changed in this PR

Reworks legacy ScrollViewer motion around frame-driven wheel decay, fitted touch velocity, and platform-specific fling simulations. It also updates animated ChangeView behavior and adds regression coverage.

Changes:

  • Adds frame-driven wheel and fling simulations.
  • Removes touch-delta quantization and revises animated scrolling.
  • Adds unit and runtime tests for motion behavior and lifecycle cleanup.

Six unresolved correctness and parity issues were identified.

File Description
IDirectManipulationHandler.cs Adds inertia-interruption notification.
DirectManipulation.cs Enables unquantized deltas and interruption handling.
ScrollVelocityTracker.cs Adds least-squares velocity estimation.
ScrollFlingSimulation.cs Adds platform-selected fling curves.
ScrollDecaySimulation.cs Adds wheel impulse decay.
ScrollContentPresenter.Managed.cs Integrates frame-driven motion and animation changes.
ScrollContentPresenter.cs Routes wheel input into decay simulations.
GestureRecognizer.Manipulation.InertiaProcessor.cs Removes ineffective finalizer cleanup.
GestureRecognizer.Manipulation.cs Exposes input timestamps and unquantized updates.
GestureRecognizer.cs Adds direct-manipulation delta configuration.
Given_ScrollVelocityTracker.cs Tests velocity fitting behavior.
Given_ScrollViewer.cs Adds scrolling and lifecycle regressions tests.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Copilot AI balanced review requested due to automatic review settings October 3, 2026 09:43
@MartinZikmund
MartinZikmund force-pushed the dev/mazi/scroll-motion branch from f0b130a to 5e602f8 Compare October 3, 2026 09:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot AI balanced review requested due to automatic review settings October 3, 2026 10:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@github-actions

github-actions Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 5m 39s —— View job


Review complete

  • Gather context (diff vs origin/dev/mazi/scrollview-wheel-parity; HEAD is 5e602f89, a rebase of the same logical commits already covered by prior review rounds)
  • Review unresolved Copilot findings (final-offset publish on press-interrupt, final drag delta before fling, precision-wheel truncation, Android fling curve/duration mismatch)
  • Review unresolved github-code-quality findings on Given_ScrollVelocityTracker.cs
  • Re-check previously-fixed items (ScrollVelocityTracker.cs location, epsilon zero-checks, #if __SKIA__ test wrapping) are still fixed
  • Check AGENTS.md rules (async/cancellation, platform suffixes, DP correctness, root-cause-first, allocations, test coverage, events, code style)
  • Post inline findings
  • Post summary

Verdict: fix-first

2 new findings this pass, both confirmed by independent derivation (not just repeating bot output):

  1. ScrollContentPresenter.Managed.cs (~1088-1104), moderate/high: the per-frame rewrite of OnInertiaStarting's velocity-fitted branch dropped the args.Delta application that the pre-PR code on origin/dev/mazi/scrollview-wheel-parity had (with the comment "Even if usually empty, make sure to apply the delta"). Traced through GestureRecognizer.Manipulation.cs: the change-set that triggers the transition into inertia is folded into internal state by CommitChanges but never raised through OnUpdated, so this is a genuine, silent loss of the final drag delta — StartFling now seeds its curves from a stale offset. Confirmed as a regression by diffing against base, not a pre-existing limitation.
  2. ScrollFlingSimulation.cs (~79-90), moderate: re-derived the Android OverScroller spline math from AOSP's getSplineFlingDuration/getSplineFlingDistance. The distance formula is algebraically correct (matches AOSP exactly), but duration = DecelerationRate * Inflexion * androidDuration scales the real spline duration down by ~17.5% — GetPosition/GetVelocity reach the (correctly-computed) final distance early and then clamp, so the curve decelerates more abruptly than real Android rather than easing out over the platform's actual fling time. Total travel distance is unaffected; only the timing/feel of the curve is off, undercutting the PR's stated Android-parity goal.

Investigated and ruled out (not re-flagged):

  • Copilot's "press interrupting a fling never publishes a final offset" claim: traced OnInertiaInterrupted → DirectManipulation.TryProcessDown → OnDirectManipulationCompleted's _isResuming guard → the later, non-suppressed OnCompleted for the resumed manipulation. The final offset is published there, which is exactly what When_Fling_Is_Interrupted_Then_Final_Offset_Is_Published already exercises. Not a bug.
  • The precision-wheel truncation Copilot flagged in ScrollContentPresenter.cs (GetHorizontalScrollWheelDelta/GetVerticalScrollWheelDelta rounding small deltas to 0 outside the iOS/macOS branch): confirmed this formula is byte-for-byte unchanged from the pre-PR base — only the call site moved from Set(...) to AddWheelImpulse(...). Pre-existing limitation, not a regression introduced here, so left out of scope for this PR's inline findings.
  • github-code-quality's nullable-dereference and int * int precision nitpicks on Given_ScrollVelocityTracker.cs: both are false-positive-grade analyzer noise (the Assert.IsNotNull pattern is used throughout the codebase; i is bounded ≤4 so no overflow risk) — not worth blocking on.
  • Confirmed previously-flagged items are genuinely fixed at this HEAD: ScrollVelocityTracker.cs now lives under ScrollContentPresenter/ (no longer wildcard-compiled into the WinRT variants), ScrollDecaySimulation/ScrollFlingSimulation zero-checks use a 1e-9 epsilon, and the two animated-ChangeView tests use [PlatformCondition(ConditionMode.Exclude, RuntimeTestPlatforms.NativeWinUI)] instead of #if __SKIA__ (verified no [TestMethod] in the file is still #if-wrapped).
  • No event Action<T>, .Result/.GetAwaiter().GetResult(), or async void patterns in the diff. The dropped ~CompositionInertiaProcessorTimer() finalizer is a reasonable cleanup, not a regression (the processor is already disposed deterministically).
    · branch

@github-actions

github-actions Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 6m 13s —— View job


Review complete

  • Gather context (diff vs origin/dev/mazi/scrollview-wheel-parity, read changed files)
  • Check status of previously-flagged issues (velocity tracker placement/tests, epsilon fixes, #if __SKIA__ test discovery, Copilot's 4 findings)
  • Re-review ScrollContentPresenter.Managed.cs changes since last pass
  • Re-review GestureRecognizer* / DirectManipulation.cs changes
  • Re-review runtime tests in Given_ScrollViewer.cs
  • Post inline findings
  • Post summary

Verdict: fix-first. 3 new findings posted inline, all moderate severity — no crashes or data loss, but each works against a correctness/parity goal this PR explicitly sets out to achieve.

Previously-flagged issues — confirmed resolved, not re-flagged:

  • ScrollVelocityTracker.cs now lives under ScrollContentPresenter/, compiled by Uno.UI only.
  • ScrollVelocityTracker has dedicated unit test coverage (Given_ScrollVelocityTracker.cs).
  • The _velocity != 0 floating-point equality checks in ScrollDecaySimulation/ScrollFlingSimulation now use an epsilon.
  • The two animated-ChangeView runtime tests use [PlatformCondition(ConditionMode.Exclude, RuntimeTestPlatforms.NativeWinUI)] instead of #if __SKIA__, restoring test discovery and WinUI-parity coverage.
  • Copilot's "fractional wheel delta gets rounded to zero before AddWheelImpulse" finding is real but pre-existing (GetHorizontalScrollWheelDelta/GetVerticalScrollWheelDelta in ScrollContentPresenter.mux.cs are unchanged by this PR) — out of scope here, not re-flagged.

New findings this pass (3, all unaddressed from Copilot's automated pass — confirmed independently):

  1. ScrollContentPresenter.Managed.cs — OnInertiaInterrupted stops the fling/wheel decay but, unlike every other interruption path added in this PR, never calls the ...AndPublishFinalOffsets variant. Its own doc comment says it's "the only notification" the handler gets for a press that's held without releasing, so a held press can leave ViewChanged stuck on a stale intermediate record and IsScrollAnimationInProgress reporting false before the stopped position is ever committed.
  2. ScrollContentPresenter.Managed.cs — the fling-launch branch of OnInertiaStarting no longer applies args.Delta (the final pointer translation bundled into the inertia-starting event) before calling StartFling, unlike the code it replaced. The last drag increment at release can be silently dropped.
  3. ScrollFlingSimulation.cs — Create scales Android's real OverScroller spline duration by DecelerationRate * Inflexion (≈0.825), so the reported Duration is ~18% shorter than genuine Android timing. The error algebraically cancels out in the distance formula (so FinalPosition still matches Android), but the curve reaches that position measurably faster than the real spline — worth confirming this is intentional, since no test pins Duration/FinalPosition against hand-computed Android reference values.

Cross-cutting: no SOLID/layering issues, no banned event Action<T>, no new .Result/async void, allocations on the frame-driven hot path stay on value types (ScrollFlingSimulation/ScrollDecaySimulation are structs) as before. Platform branching (ScrollFlingSimulation._isApplePlatform) correctly uses OperatingSystem.IsX() runtime checks per this repo's Skia-only-UI targeting rules, not #if.
· branch

MartinZikmund and others added 17 commits October 10, 2026 17:17
WinUI's ScrollViewer animates ChangeView through DirectManipulation, so
the curve is not in the XAML sources. Measured on WinUI 1.8 (throwaway
oracle, 90 runs at 100% and 250% scale): 1.4ms per physical pixel within
[175, 475]ms, along a curve a quartic ease-out fits as well as any.
A completed animation publishes its exact target as the final offset.
IsScrollAnimationInProgress covers the zoom animation too, which arranges
the ScrollViewer when it ends so the offset recompute runs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Usdq5JJfVkzKcYtwkKCRUy
Easing is checked per frame from the animation's first moving frame, so a
slow first frame does not count against it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Usdq5JJfVkzKcYtwkKCRUy
CalendarPanel scrolls to an offset taken from its own estimated bounds,
ahead of the extent the ScrollViewer was arranged with, like ListView's
layout compensation: route it through ChangeViewForLayoutAdjustment so the
request-time intent clamp does not cut it to the stale range.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Usdq5JJfVkzKcYtwkKCRUy
Wrapping a [TestMethod] in #if breaks test discovery: exclude NativeWinUI
with PlatformCondition and keep #if inside the bodies instead.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Usdq5JJfVkzKcYtwkKCRUy
- Only along the axes the gesture moves this content: the velocity fit runs
  on the raw pointer, which drifts across a railed axis (whose recognizer
  velocity is zeroed) or one this presenter cannot scroll.
- The release is a velocity sample too, as in Android's VelocityTracker: a
  finger that rested before lifting sends no move while still, so only the
  release shows the gap. The tracker then reports zero rather than no data,
  which fell back to the recognizer's stale fast velocity.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Usdq5JJfVkzKcYtwkKCRUy
A Set that takes over a running scroll animation (wheel decay, touch,
another ChangeView) stopped it, and its Stopped handler published a final
ViewChanged in the middle of the motion that replaced it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Usdq5JJfVkzKcYtwkKCRUy
WinUI's ScrollViewer.IsInManipulation covers a touch manipulation and the
DirectManipulation inertia, snap and animated view changes that follow it.
Uno drives those from the presenter and never set IsInDirectManipulation,
so FlipView's FixOffset timer, which waits while IsInManipulation is true,
could fire mid-snap and pull the view back to the previous item.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Usdq5JJfVkzKcYtwkKCRUy
The landing and the room check used position + velocity / lambda, which
each frame preserves in theory but not in floating point: five 4px
detents came to rest on 19.999999999999996, and the next ones on
79.99999999999999 with an 80px scrollable height, short of the end.
Keep the target as the sum of the impulses instead.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Usdq5JJfVkzKcYtwkKCRUy
IsScrollAnimationInProgress read the animation's wall-clock Remaining, which hits zero before a late last frame applies and publishes the final offsets. FlipView's offset fix could then run mid-snap and scroll back. Track the running animation until it stops instead.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Usdq5JJfVkzKcYtwkKCRUy
The offset fix armed by sizing could still be pending when the flick started. Postponed to the end of the manipulation, it suppresses the snap's selection change and scrolls back, exactly as WinUI's FixOffset does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Usdq5JJfVkzKcYtwkKCRUy
The release repeats the last move's position, so fitting it as a sample
shrinks the fling velocity and can even reverse it. Like Android, only
its time is used, to detect a finger that rested before lifting.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HAeXvsKrnYPF97TrJye7CZ
Copilot AI balanced review requested due to automatic review settings October 10, 2026 15:29
@MartinZikmund
MartinZikmund force-pushed the dev/mazi/scroll-motion branch from bfc9946 to 1e8e0e7 Compare October 10, 2026 15:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 13s —— View job


Re-review (synchronize)

Verdict: ship. No new findings, no inline comments.

New since the last round: 5b487db9 and 1e8e0e7a. The release is no longer fed into the velocity fit as a sample. GetVelocity(releaseTimeMs) uses only the release time, and returns zero velocity when the pointer rested longer than AssumeStoppedMs before lifting.

  • The release repeats the last move's position, so fitting it bent the quadratic and could shrink or reverse the velocity. Passing only the time is the right fix and matches Android.
  • releaseTimeMs - _samples[_index].TimeMs > AssumeStoppedMs is false when releaseTimeMs is null, so other callers are unaffected. The _count > 0 guard covers an empty buffer.
  • The release time is only passed when _velocityTrackerContacts <= 1, as before.
  • A unit test covers the release timing.

Still open, optional:

  • _runningScrollAnimation is assigned after visual.StartAnimation(...). If the animation stopped synchronously inside that call, OnStopped would find nothing to clear and the field would stay set. This is unlikely given the 175 ms minimum duration. Assigning it before StartAnimation removes the ordering dependence.

Not code-related:

  • Recent CI builds show about 118 screenshot diffs on Linux and about 1,140 on Windows. That is too broad to be scroll motion, so please confirm the base branch shows the same diffs before merge.
  • The docs checklist items are unchecked.

I made no code changes and did not build or run tests. This was a code-only check.
· branch

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 238789 found UI Test snapshots differences: skia-linux-screenshots: 118, skia-windows-screenshots: 1293

Details
  • skia-linux-screenshots: 118 changed over 2458

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ClipboardTests.png-dark
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • Buttons.png-dark
    • Buttons.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • CompositionEffectBrush.png-dark
    • CompositionEffectBrush.png
    • CompositionNineGridBrush_Source_Changes.png-dark
    • CompositionNineGridBrush_Source_Changes.png
    • Gamepad_CurrentReading.png-dark
    • Gamepad_Enumeration.png-dark
    • DisplayInformation.png-dark
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • DoubleImageBrushInList.png-dark
    • DoubleImageBrushInList.png
    • Focus_FocusVisual_Properties.png-dark
    • Focus_FocusVisual_Properties.png
  • skia-windows-screenshots: 1293 changed over 2486

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedIconPage.png-dark
    • AnimatedVisualsTestbedPage.png-dark
    • ApplicationViewSpanningRectsPage.png-dark
    • AutoBorderStretchwithrightmargin.png-dark
    • AutoBorderStretchwithrightmargin.png
    • AutomationProperties_Relations.png-dark
    • AutoSuggestBox_Keyboard.png-dark
    • AutoSuggestBox_Keyboard.png
    • Basics Pivot Test.png-dark
    • Basics Pivot Test.png
    • BindableDrawerLayout_ChangePane.png-dark
    • BindableDrawerLayout_ChangePane.png
    • BorderLeftwithmargins.png-dark
    • BorderLeftwithmargins.png
    • Border_AntiAlias.png-dark
    • Border_AntiAlias.png
    • Border_CornerRadius_Gradient.png-dark
    • Border_CornerRadius_Gradient.png
    • Button_Enabled_Control_Disabled.png-dark
    • Button_Enabled_Control_Disabled.png

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/automation Categorizes an issue or PR as relevant to project automation platform/wasm 🌐 Categorizes an issue or PR as relevant to the WebAssembly platform

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scroll motion has no frame clock, and touch/wheel deltas are quantized 🩵

5 participants