Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect documentation for InteractionTracker #100

Open
Youssef1313 opened this issue Mar 5, 2024 · 0 comments
Open

Incorrect documentation for InteractionTracker #100

Youssef1313 opened this issue Mar 5, 2024 · 0 comments
Assignees

Comments

@Youssef1313
Copy link

Page: https://learn.microsoft.com/en-us/windows/windows-app-sdk/api/winrt/microsoft.ui.composition.interactions.interactiontracker?view=windows-app-sdk-1.3

The Idle → Inertia transition doc says:

This state transition only happens when the InteractionTracker is in the Idle state and TryUpdatePositionWithVelocity or TryUpdateScaleWithVelocity is called.

However, given:

            var interactionTracker = InteractionTracker.CreateWithOwner(_visual.Compositor, new MyOwner());
            interactionTracker.MinPosition = new(-1000);
            interactionTracker.MaxPosition = new(1000);
            var vis = VisualInteractionSource.Create(_visual);

            interactionTracker.InteractionSources.Add(vis);

            vis.ManipulationRedirectionMode = VisualInteractionSourceRedirectionMode.CapableTouchpadAndPointerWheel;
            vis.PositionXSourceMode = InteractionSourceMode.EnabledWithoutInertia;
            vis.PositionYSourceMode = InteractionSourceMode.EnabledWithoutInertia;

Just scrolling with mouse wheel will cause Idle → Inertia transition. There are no TryUpdatePositionWithVelocity calls involved.

Also, the method name is TryUpdatePositionWithAdditionalVelocity, so that's a typo as well.

NOTE: When Idle transitions to Inertia with mouse wheel, the request id is always zero, indicating that it doesn't involve TryUpdatePositionWithAdditionalVelocity. Because:

https://learn.microsoft.com/en-us/windows/windows-app-sdk/api/winrt/microsoft.ui.composition.interactions.interactiontracker.tryupdatepositionwithadditionalvelocity?view=windows-app-sdk-1.4

Returns the request ID. On state transitions, the request which caused the change in state will be included in the args. These IDs will start at 1 and increase with each try call during the lifetime of the application.

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

No branches or pull requests

2 participants