Table of Contents

Class HitTestResult<TElement>

Namespace
FlowGraph.Core.Input
Assembly
FlowGraph.Core.dll

Result of a hit test operation against a specific element type.

public class HitTestResult<TElement>

Type Parameters

TElement

The type of element that can be hit.

Inheritance
HitTestResult<TElement>
Inherited Members

Properties

CanvasPosition

The position where the hit occurred, in canvas coordinates.

[CoordinateSpace(CoordinateSpace.Canvas)]
public Point CanvasPosition { get; init; }

Property Value

Point

Distance

Distance from the exact hit point to the element's bounds or center. Useful for edge hit testing where some tolerance is needed.

public double Distance { get; init; }

Property Value

double

Element

The element that was hit, or null/default if nothing was hit.

public TElement? Element { get; init; }

Property Value

TElement

IsHit

Whether an element was hit.

public bool IsHit { get; }

Property Value

bool

LocalPosition

The position where the hit occurred, relative to the element's origin. Only meaningful when Element is not null.

[CoordinateSpace(CoordinateSpace.Local)]
public Point LocalPosition { get; init; }

Property Value

Point

Methods

NoHit(Point)

Creates an empty (no hit) result.

public static HitTestResult<TElement> NoHit(Point canvasPosition)

Parameters

canvasPosition Point

Returns

HitTestResult<TElement>