unoplatform / uno

Build Mobile, Desktop and WebAssembly apps with C# and XAML. Today. Open source and professionally supported.
https://platform.uno
Apache License 2.0
8.45k stars 685 forks source link

`InteractionTracker` may not be playing nice with touch and manipulation events #16550

Closed Youssef1313 closed 2 weeks ago

Youssef1313 commented 2 weeks ago

Current behavior

If you have an element that you use with InteractionTracker and subscribe to its manipulation events, it's likely that after InteractionTracker is done with its work, you may get incorrect manipulation events.

Expected behavior

Should match WinUI

How to reproduce it (as minimally and precisely as possible)

  1. Open InteractionTrackerAndExpressionAnimationSample.xaml

  2. Modify border1 to subscribe to manipulation events:

    <Border x:Name="border1" Width="100" Height="100" Background="Red" ManipulationMode="All" ManipulationStarting="OnManipulationStarting" ManipulationStarted="OnManipulationStarted" ManipulationDelta="OnManipulationDelta" ManipulationCompleted="OnManipulationCompleted" ManipulationInertiaStarting="OnManipulationInertiaStarting" />
  3. Add logging TextBlock in the StackPanel after the two borders:

    <TextBlock x:Name="logTB" />
  4. In code-behind:

    private void OnManipulationStarting(object sender, ManipulationStartingRoutedEventArgs e)
    {
        logTB.Text += "OnManipulationStarting\r\n";
    }
    
    private void OnManipulationStarted(object sender, ManipulationStartedRoutedEventArgs e)
    {
        logTB.Text += "OnManipulationStarted\r\n";
    }
    
    private void OnManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
    {
        logTB.Text += "OnManipulationDelta\r\n";
    }
    
    private void OnManipulationCompleted(object sender, ManipulationCompletedRoutedEventArgs e)
    {
        logTB.Text += "OnManipulationCompleted\r\n";
    }
    
    private void OnManipulationInertiaStarting(object sender, ManipulationInertiaStartingRoutedEventArgs e)
    {
        logTB.Text += "OnManipulationInertiaStarting\r\n";
    }
  5. With touch device, press with finger on the red border

  6. Move your finger outside the border to the left (so that InteractionTracker takes over)

  7. Release finger

  8. Press with finger outside the border

  9. Move your finger to inside the border

The expectation is that we should only get OnManipulationStarting on the first step.

What's likely going to happen is we'll start getting all manipulation events when we start getting pointer move from step 9.

Workaround

No response

Works on UWP/WinUI

None

Environment

No response

NuGet package version(s)

No response

Affected platforms

No response

IDE

No response

IDE version

No response

Relevant plugins

No response

Anything else we need to know?

No response