dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.21k stars 1.75k forks source link

Image PointerGestureRecognizer PointerEntered and PointerExited Events not firing #19986

Open ovbarnett opened 9 months ago

ovbarnett commented 9 months ago

Description

Hi there, I was looking at PointerGestureRecognizer and PointerEntered / PointerExited events to change the color and the size of an image and a label but from what I see so far that PointerEntered and PointerExited events are not firing at all even though it should as per this example in documentation https://learn.microsoft.com/en-us/dotnet/maui/fundamentals/gestures/pointer?view=net-maui-7.0&tabs=macios

https://github.com/dotnet/maui/assets/62110195/8275752e-54e5-4247-8085-590fab73fd6e

I have a screen recording attached for your review

Steps to Reproduce

<Image x:Name="dotnet_botImage" Source="dotnet_bot.png" SemanticProperties.Description="Cute dot net bot waving hi to you!" HeightRequest="200" HorizontalOptions="Center" >

async void OnPointerEntered(object sender, PointerEventArgs e) { // Handle the pointer entered event await DisplayAlert("OnPointerEntered Fired", "OnPointerEntered Fired","ok"); } async void OnPointerExited(object sender, PointerEventArgs e) { // Handle the pointer exited event await DisplayAlert("OnPointerExited Fired", "OnPointerExited Fired", "ok"); } async void Image_Tapped(object sender, EventArgs e) { // Handle the pointer exited event await DisplayAlert("Image_Tapped Fired", "Image_Tapped Fired", "ok"); } ### Link to public reproduction project repository https://github.com/ovbarnett/PointerGestureRecognizer-PointerEntered-and-PointerExited-Events-not-firing ### Version with bug 7.0.96 ### Is this a regression from previous behavior? No, this is something new ### Last version that worked well Unknown/Other ### Affected platforms iOS ### Affected platform versions I have tested it on ios 16.4 ### Did you find any workaround? no ### Relevant log output _No response_
dev-nautischool commented 9 months ago

I have tried the same exact code (copied from the documentation [ovbarnett] linked) on an Android device (Samsung A53) and I have the same behaviour, the PointerEntered, PointerExited and PointerMoved are not firing.

While debugging I see the following traces (not coming from my code) displayed when I press and release on the image: [ViewRootImpl@8327209[MainActivity]] ViewPostIme pointer 0 [GestureDetector] obtain mCurrentDownEvent. id: 555827624 caller: mono.android.view.View_OnTouchListenerImplementor.n_onTouch:-2 mono.android.view.View_OnTouchListenerImplementor.onTouch:31 android.view.View.dispatchTouchEvent:16208 [GestureDetector] obtain mCurrentMotionEventRaw. action: 2 id: 197923056 [ViewRootImpl@8327209[MainActivity]] ViewPostIme pointer 1

If I debug the same code on Windows platform events are firing.

XamlTest commented 8 months ago

Verified this on VS 17.10.0 Preview 1.0(8.0.6). Repro on Android 14.0-API34 and iOS 17.2, not repro on Windows 11 and MacCatalyst with below Project: PointerGestureRecognizer-PointerEntered-and-PointerExited-Events-not-firing.zip