Browse Source

add contains exclusive.

pull/7165/head
Dan Walmsley 5 years ago
parent
commit
a19dc794a5
  1. 2
      src/Avalonia.Controls/Platform/ScreenHelper.cs
  2. 12
      src/Avalonia.Visuals/Rect.cs

2
src/Avalonia.Controls/Platform/ScreenHelper.cs

@ -11,7 +11,7 @@ namespace Avalonia.Platform
{
foreach (Screen screen in screens)
{
if (screen.Bounds.Contains(point))
if (screen.Bounds.ContainsExclusive(point))
{
return screen;
}

12
src/Avalonia.Visuals/Rect.cs

@ -252,6 +252,18 @@ namespace Avalonia
return p.X >= _x && p.X <= _x + _width &&
p.Y >= _y && p.Y <= _y + _height;
}
/// <summary>
/// Determines whether a point is in the bounds of the rectangle, exclusive of the
/// rectangle's bottom/right edge.
/// </summary>
/// <param name="p">The point.</param>
/// <returns>true if the point is in the bounds of the rectangle; otherwise false.</returns>
public bool ContainsExclusive(Point p)
{
return p.X >= _x && p.X < _x + _width &&
p.Y >= _y && p.Y < _y + _height;
}
/// <summary>
/// Determines whether the rectangle fully contains another rectangle.

Loading…
Cancel
Save