Closed kasanhoon closed 9 months ago
This issue looks very similar to the one I reported here #19329. Maybe these two are duplicates. I don't know.
@kasanhoon Would you possibly have a screenshot? If not, it's ok.
It's just that I've been debugging #19329 and my test sample is not OK because on macOS the image seems to be sized differently than on Windows. But the bug is there somewhere because pointer over grids does not work.
It seems to me that:
var point = e.GetPosition((View)sender);
works OK, butvar point = e.GetPosition(ChildView);
(i.e. a non-sender view) does not work OK@MartyIX You're right. Previously, even if the sender's child was passed as a parameter to GetPosition, it correctly returned relative coordinates. Now, this issue is happening only in the .NET 8 environment on iOS. The same code, when executed on iOS with .NET 7, returns the relative coordinates of the sender's child correctly.
<.net 7 ios screenshot>
<.net 8 ios screenshot>
The LightBlue area is the Grid that receives the tap event, and the LightPink area is the child image of the Grid. The size of the LightPink area is the same in both scenarios, with a width of 100px and a height of 100px. When the first pixel of the LightPink area is selected, .NET 7 correctly returns 0,0, but .NET 8 returns the distance from the origin point 0,0 of the LightBlue area.
So you mentioning that it works in .NET 7 and not in .NET 8 made check the source code and it seems to me that there is a difference on this line:
NET7
NET8
Notice that in .NET 8, the variable is not related to element
. So it seems like a plausible explanation but I have not (yet?) verified whether changing the variable would fix the issue (and who knows what it can break).
We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.
Potential workaround pending updated package release.
Description
I am encountering an issue with the TapGestureRecognizer in a .NET 8 MAUI iOS environment.
The GetPosition() method from TappedEventArgs is supposed to return the relative coordinates of the touch point, but it's yielding incorrect values
MainPage.xaml
MainPage.xaml.cs
In the .NET 7 environment, this code correctly returns the relative coordinates of the touch point on
ChildView
. However, in the .NET 8 environment, specifically on iOS, it seems to return absolute coordinates instead of relative ones. This behavior appears to be isolated to theiOS
platform in the .NET 8 environment.Steps to Reproduce
MainPage.xaml
andMainPage.xaml.cs
with the code provided above.Link to public reproduction project repository
No response
Version with bug
8.0.3
Is this a regression from previous behavior?
Yes, this used to work in .NET MAUI
Last version that worked well
7.0.101
Affected platforms
iOS
Affected platform versions
ios 17.0
Did you find any workaround?
No response
Relevant log output