question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

WinUI3: Rotation in Manipulation events is wrong

See original GitHub issue

Describe the bug When using the ManipulationDelta event to track rotation changes, the values reported are way too large. Rotating your fingers reports a value exactly 180/Pi too large.

Steps to reproduce the bug

  1. Add the following XAML to the view:
        <Border Background="Red" Width="300" Height="300" 
                ManipulationMode="All"
                ManipulationStarted="Border_ManipulationStarted"
                ManipulationDelta="Border_ManipulationDelta"
                ManipulationCompleted="Border_ManipulationCompleted">
            <TextBlock Text="Rotate me" x:Name="status" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center" />
        </Border>
  1. Add the following code-behind:
        private double angle = 0;
        private void Border_ManipulationStarted(object sender, ManipulationStartedRoutedEventArgs e)
        {
            angle = 0;
            status.Text = "Begin";
        }

        private void Border_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
        {
            angle += e.Delta.Rotation;
            status.Text = $"Cumulative (sum of deltas): {angle}\nDelta: {e.Delta.Rotation}\nCumulative: {e.Cumulative.Rotation}";
        }

        private void Border_ManipulationCompleted(object sender, ManipulationCompletedRoutedEventArgs e)
        {
            status.Text += "\nCompleted!";
        }
  1. Run the application on a touch screen, and rotate with two fingers over the red box.
  2. Observe the values reported doesn’t match what you’re doing (all 3 values written are wrong of about 17-18 times larger than expected).

Expected behavior Rotation values reported matches actual user input

Screenshots Untitled Project

Version Info

NuGet package version: [Microsoft.WinUI 3.0.0-preview3.201113.0]

Windows app type:

UWP Win32
Yes Yes
Windows 10 version Saw the problem?
Insider Build (xxxxx)
May 2020 Update (19041) Yes
November 2019 Update (18363) Yes
May 2019 Update (18362)
October 2018 Update (17763)
April 2018 Update (17134)
Fall Creators Update (16299)
Creators Update (15063)
Device form factor Saw the problem?
Desktop Yes (Surface Book 2 & Surface Go 1
Xbox
Surface Hub
IoT

Additional context

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
codendonecommented, Apr 14, 2021

I agree, and I had hoped we’d get to this sooner. This is scheduled to be fixed for 0.8, and hopefully will be completed around the end of April.

0reactions
dotMortencommented, Jun 29, 2021

sorry forgot to close this when I confirmed the fix last week. Thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

ManipulationInertiaStartingRoute...
Provides data for the ManipulationInertiaStarting event. ... InitializeComponent(); forceManipulationsToEnd = false; ManipulateMe. ... Rotation = (e.Delta.
Read more >
WinUI 3 | XAML Brewer, by Diederik Krols
Mapsui enables users to interact with the map through panning, zooming, and rotation. It provides touch and mouse event handling, making it suitable...
Read more >
Manipulation events not firing - wpf
After I removed event hooks for all content on manipulation events, leaving only the hooks in the parent Grid, and then pressed VERY...
Read more >
Touched ( Part 3 )–Manipulation and Gesture Support
It supports manipulation events on UIElements and those events report translation, rotation and scaling of the element in question.
Read more >
ScottPlot Changelog
RenderFinished event that provides a RenderDetails indicating whether axes or layout changed (#2801); FormsPlot: Added RefreshQueue() to allow facilitate ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found