Browse Source

fix: handle only events within control bounds or ClipToBounds=false,

otherwise there are problems with items not in visible part processing the events
pull/570/head
donandren 10 years ago
parent
commit
2bcedd44a7
  1. 7
      src/Avalonia.Input/InputExtensions.cs

7
src/Avalonia.Input/InputExtensions.cs

@ -24,13 +24,14 @@ namespace Avalonia.Input
public static IEnumerable<IInputElement> GetInputElementsAt(this IInputElement element, Point p)
{
Contract.Requires<ArgumentNullException>(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<IInputElement>()))
{
@ -41,7 +42,7 @@ namespace Avalonia.Input
}
}
if (transformedBounds.Contains(p))
if (containsPoint)
{
yield return element;
}

Loading…
Cancel
Save