Browse Source
Fix tooltip hit test following a dirtyRect invalidation not respecting IsHitTestVisible (#19642)
HitTester sees visuals with IsHitTestVisible=false unless you specifically filter them out! Added XML doc warning.
pull/19650/head
Tom Edwards
5 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
6 additions and
7 deletions
-
src/Avalonia.Base/Rendering/IRenderer.cs
-
src/Avalonia.Controls/TopLevel.cs
|
|
|
@ -80,6 +80,10 @@ namespace Avalonia.Rendering |
|
|
|
/// <summary>
|
|
|
|
/// Hit tests a location to find the visuals at the specified point.
|
|
|
|
/// </summary>
|
|
|
|
/// <remarks>
|
|
|
|
/// <para>⚠️ This method is low-level and <b>DOES NOT respect <see cref="Input.InputElement.IsHitTestVisible"/></b>.</para>
|
|
|
|
/// <para>Use <see cref="Input.InputExtensions"/> to perform input hit testing, or provide your own <paramref name="filter"/> function.</para>
|
|
|
|
/// </remarks>
|
|
|
|
/// <param name="p">The point, in client coordinates.</param>
|
|
|
|
/// <param name="root">The root of the subtree to search.</param>
|
|
|
|
/// <param name="filter">
|
|
|
|
@ -92,12 +96,7 @@ namespace Avalonia.Rendering |
|
|
|
/// <summary>
|
|
|
|
/// Hit tests a location to find first visual at the specified point.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="p">The point, in client coordinates.</param>
|
|
|
|
/// <param name="root">The root of the subtree to search.</param>
|
|
|
|
/// <param name="filter">
|
|
|
|
/// A filter predicate. If the predicate returns false then the visual and all its
|
|
|
|
/// children will be excluded from the results.
|
|
|
|
/// </param>
|
|
|
|
/// <inheritdoc cref="HitTest(Point, Visual, Func{Visual, bool}?)"/>
|
|
|
|
/// <returns>The visual at the specified point, topmost first.</returns>
|
|
|
|
Visual? HitTestFirst(Point p, Visual root, Func<Visual, bool>? filter); |
|
|
|
} |
|
|
|
|
|
|
|
@ -952,7 +952,7 @@ namespace Avalonia.Controls |
|
|
|
var clientPoint = this.PointToClient(lastPos); |
|
|
|
if (dirtyRect.Contains(clientPoint)) |
|
|
|
{ |
|
|
|
_tooltipService.Update(this, HitTester.HitTestFirst(clientPoint, this, null)); |
|
|
|
_tooltipService.Update(this, this.InputHitTest(clientPoint, enabledElementsOnly: false) as Visual); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|