From 8ae41138693efd59c5d23842e452327a70c69377 Mon Sep 17 00:00:00 2001 From: Andrey Kunchev Date: Sun, 20 Oct 2019 17:04:09 +0300 Subject: [PATCH] tmp: fix non deffered rendering hit testing pr: 3357 - merged --- .../Notifications/WindowNotificationManager.cs | 8 +++++++- src/Avalonia.Controls/Primitives/AdornerLayer.cs | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.Controls/Notifications/WindowNotificationManager.cs b/src/Avalonia.Controls/Notifications/WindowNotificationManager.cs index 1a9347e317..39af51202c 100644 --- a/src/Avalonia.Controls/Notifications/WindowNotificationManager.cs +++ b/src/Avalonia.Controls/Notifications/WindowNotificationManager.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Reactive.Linq; using System.Threading.Tasks; using Avalonia.Controls.Primitives; +using Avalonia.Rendering; using Avalonia.VisualTree; namespace Avalonia.Controls.Notifications @@ -14,7 +15,7 @@ namespace Avalonia.Controls.Notifications /// /// An that displays notifications in a . /// - public class WindowNotificationManager : TemplatedControl, IManagedNotificationManager + public class WindowNotificationManager : TemplatedControl, IManagedNotificationManager, ICustomSimpleHitTest { private IList _items; @@ -153,5 +154,10 @@ namespace Avalonia.Controls.Notifications adornerLayer?.Children.Add(this); } + + public bool HitTest(Point point) + { + return VisualChildren.Any(ctrl => (ctrl as ICustomSimpleHitTest)?.HitTest(point) ?? ctrl.TransformedBounds?.Contains(point) == true); + } } } diff --git a/src/Avalonia.Controls/Primitives/AdornerLayer.cs b/src/Avalonia.Controls/Primitives/AdornerLayer.cs index ebe5e0a93e..a8053f1d20 100644 --- a/src/Avalonia.Controls/Primitives/AdornerLayer.cs +++ b/src/Avalonia.Controls/Primitives/AdornerLayer.cs @@ -140,7 +140,7 @@ namespace Avalonia.Controls.Primitives public bool HitTest(Point point) { - return Children.Any(ctrl => ctrl.TransformedBounds?.Contains(point) == true); + return Children.Any(ctrl => (ctrl as ICustomSimpleHitTest)?.HitTest(point) ?? ctrl.TransformedBounds?.Contains(point) == true); } private class AdornedElementInfo