Browse Source

Fix custom hit testing (#5968)

* Fix custom hit testing
* Use ICustomHitTest as it's intended to be used in defered renderer

Co-authored-by: Dan Walmsley <dan@walms.co.uk>
Co-authored-by: Steven Kirk <grokys@users.noreply.github.com>
Co-authored-by: Steven Kirk <grokys@gmail.com>
pull/6014/head
Wiesław Šoltés 5 years ago
committed by GitHub
parent
commit
86b9a60a4c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      src/Avalonia.Controls/Primitives/LightDismissOverlayLayer.cs
  2. 2
      src/Avalonia.Visuals/Rendering/SceneGraph/Scene.cs

3
src/Avalonia.Controls/Primitives/LightDismissOverlayLayer.cs

@ -52,8 +52,7 @@ namespace Avalonia.Controls.Primitives
{
if (InputPassThroughElement is object)
{
var p = point.Transform(this.TransformToVisual(VisualRoot)!.Value);
var hit = VisualRoot.GetVisualAt(p, x => x != this);
var hit = VisualRoot.GetVisualAt(point, x => x != this);
if (hit is object)
{

2
src/Avalonia.Visuals/Rendering/SceneGraph/Scene.cs

@ -257,7 +257,7 @@ namespace Avalonia.Rendering.SceneGraph
if (childCount == 0 || wasVisited)
{
if ((wasVisited || FilterAndClip(node, ref clip)) &&
(node.Visual is ICustomSimpleHitTest custom ? custom.HitTest(_point) : node.HitTest(_point)))
(node.Visual is ICustomHitTest custom ? custom.HitTest(_point) : node.HitTest(_point)))
{
_current = node.Visual;

Loading…
Cancel
Save