WinUI3: Rotation in Manipulation events is wrong
See original GitHub issueDescribe 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
- 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>
- 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!";
}
- Run the application on a touch screen, and rotate with two fingers over the red box.
- 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
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:
- Created 3 years ago
- Comments:6 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
sorry forgot to close this when I confirmed the fix last week. Thank you!