Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(pointers): WASM Fix possible unrelated pointer entered #18046

Merged
merged 2 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/Uno.UI/Runtime/BrowserPointerInputSource.wasm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ internal partial class BrowserPointerInputSource : IUnoCorePointerInputSource
private static readonly Logger? _logTrace = _log.IsTraceEnabled(LogLevel.Trace) ? _log : null;

private ulong _bootTime;
private bool _isOver;
private PointerPoint? _lastPoint;
private CoreCursor _pointerCursor = new(CoreCursorType.Arrow, 0);

Expand Down Expand Up @@ -107,11 +108,18 @@ private static int OnNativeEvent(

switch (evt)
{
case HtmlPointerEvent.pointerover when that._isOver:
// If there isn't any html node that hit-tested, we might get a pointer-over event, but we are interested only in pointer entering over the window
_logTrace?.Trace("Ignoring pointer-over event since pointer is already over the window.");
break;

case HtmlPointerEvent.pointerover:
that._isOver = true;
that.PointerEntered?.Invoke(that, args);
break;

case HtmlPointerEvent.pointerleave:
that._isOver = false;
that.PointerExited?.Invoke(that, args);
break;

Expand Down
2 changes: 1 addition & 1 deletion src/Uno.UI/UI/Xaml/UIElement.Pointers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ internal struct PointerEventDispatchResult
/// </summary>
internal HitTestability GetHitTestVisibility()
{
#if __WASM__ || __SKIA__ || __MACOS__
#if UNO_HAS_ENHANCED_HIT_TEST_PROPERTY
dr1rrb marked this conversation as resolved.
Show resolved Hide resolved
return HitTestVisibility;
#else
// This is a coalesced HitTestVisible and should be unified with it
Expand Down
Loading