From 2bcedd44a7c408fe33a4c2a752413b25981eab03 Mon Sep 17 00:00:00 2001 From: donandren Date: Sat, 18 Jun 2016 14:40:15 +0300 Subject: [PATCH] fix: handle only events within control bounds or ClipToBounds=false, otherwise there are problems with items not in visible part processing the events --- src/Avalonia.Input/InputExtensions.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Avalonia.Input/InputExtensions.cs b/src/Avalonia.Input/InputExtensions.cs index 5d80653322..35ffeca7bb 100644 --- a/src/Avalonia.Input/InputExtensions.cs +++ b/src/Avalonia.Input/InputExtensions.cs @@ -24,13 +24,14 @@ namespace Avalonia.Input public static IEnumerable GetInputElementsAt(this IInputElement element, Point p) { Contract.Requires(element != null); - var transformedBounds = BoundsTracker.GetTransformedBounds((Visual)element); if (element.IsVisible && element.IsHitTestVisible && element.IsEnabledCore) { - if (element.VisualChildren.Any()) + bool containsPoint = BoundsTracker.GetTransformedBounds((Visual)element).Contains(p); + + if ((containsPoint || !element.ClipToBounds) && element.VisualChildren.Any()) { foreach (var child in ZSort(element.VisualChildren.OfType())) { @@ -41,7 +42,7 @@ namespace Avalonia.Input } } - if (transformedBounds.Contains(p)) + if (containsPoint) { yield return element; }