Browse Source

add comments explaining and remove unnecessary condition.

pull/11502/head
Dan Walmsley 3 years ago
parent
commit
215707ba7e
  1. 6
      src/Avalonia.Base/Input/PointerEventArgs.cs

6
src/Avalonia.Base/Input/PointerEventArgs.cs

@ -70,10 +70,14 @@ namespace Avalonia.Input
if (relativeTo == null)
return pt;
if (!ReferenceEquals(_rootVisual, relativeTo.VisualRoot) && relativeTo.VisualRoot is Visual v)
// If the visual the user passed in, is not connected to the same visual root
// (i.e. they called it for a control inside a popup.
if (!ReferenceEquals(_rootVisual, relativeTo.VisualRoot))
{
// Convert to absolute screen coordinates.
var screenPt = _rootVisual.PointToScreen(pt);
// Convert to client co-ordinates of the visual inside the other visual root.
return relativeTo.PointToClient(screenPt);
}

Loading…
Cancel
Save