Struct ViewportRect
- Namespace
- FlowGraph.Core.Coordinates
- Assembly
- FlowGraph.Core.dll
A rectangle in viewport coordinate space.
Viewport rectangles represent bounded regions in screen/control space. The most common use is representing the viewport bounds itself (the visible area).
public readonly record struct ViewportRect : IEquatable<ViewportRect>
- Implements
- Inherited Members
- Extension Methods
Constructors
ViewportRect(double, double, double, double)
A rectangle in viewport coordinate space.
Viewport rectangles represent bounded regions in screen/control space. The most common use is representing the viewport bounds itself (the visible area).
public ViewportRect(double X, double Y, double Width, double Height)
Parameters
Properties
Bottom
The bottom edge Y coordinate.
public double Bottom { get; }
Property Value
BottomLeft
The bottom-left corner of the rectangle.
public ViewportPoint BottomLeft { get; }
Property Value
BottomRight
The bottom-right corner of the rectangle.
public ViewportPoint BottomRight { get; }
Property Value
Center
The center of the rectangle.
public ViewportPoint Center { get; }
Property Value
Empty
An empty rectangle at the origin.
public static ViewportRect Empty { get; }
Property Value
Height
public double Height { get; init; }
Property Value
IsEmpty
Whether this rectangle is empty (has zero or negative area).
public bool IsEmpty { get; }
Property Value
Right
The right edge X coordinate.
public double Right { get; }
Property Value
TopLeft
The top-left corner of the rectangle.
public ViewportPoint TopLeft { get; }
Property Value
TopRight
The top-right corner of the rectangle.
public ViewportPoint TopRight { get; }
Property Value
Width
public double Width { get; init; }
Property Value
X
public double X { get; init; }
Property Value
Y
public double Y { get; init; }
Property Value
Methods
Contains(ViewportPoint)
Checks if this rectangle contains a point.
public bool Contains(ViewportPoint point)
Parameters
pointViewportPoint
Returns
FromSize(double, double)
Creates a viewport rect representing the full viewport area at origin.
public static ViewportRect FromSize(double width, double height)
Parameters
Returns
Inflate(double)
Returns a rectangle inflated by the specified amount on all sides.
public ViewportRect Inflate(double amount)
Parameters
amountdouble
Returns
Intersects(ViewportRect)
Checks if this rectangle intersects with another rectangle.
public bool Intersects(ViewportRect other)
Parameters
otherViewportRect
Returns
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.