Table of Contents

Class GraphHitTestResult

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

Result of a graph-wide hit test, identifying what element (if any) was hit and providing typed access to the target.

public class GraphHitTestResult
Inheritance
GraphHitTestResult
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. Zero for direct hits, positive for tolerance-based hits.

public double Distance { get; init; }

Property Value

double

Edge

Gets the hit edge, or null if an edge was not hit.

public Edge? Edge { get; }

Property Value

Edge

IsCanvasHit

Whether empty canvas space was clicked (no element hit).

public bool IsCanvasHit { get; }

Property Value

bool

IsHit

Whether anything was hit (excludes None and Canvas).

public bool IsHit { get; }

Property Value

bool

IsInputPort

Gets whether the hit port is an input port.

public bool IsInputPort { get; }

Property Value

bool

Node

Gets the hit node, or null if a node was not hit.

public Node? Node { get; }

Property Value

Node

Port

Gets the hit port, or null if a port was not hit.

public Port? Port { get; }

Property Value

Port

PortOwner

Gets the owner node of a hit port, or null if a port was not hit.

public Node? PortOwner { get; }

Property Value

Node

ResizeHandle

Gets the hit resize handle position, or null if a resize handle was not hit.

public ResizeHandlePosition? ResizeHandle { get; }

Property Value

ResizeHandlePosition?

ResizeHandleOwner

Gets the node that owns a hit resize handle, or null if a resize handle was not hit.

public Node? ResizeHandleOwner { get; }

Property Value

Node

ShapeResizeHandle

Gets the hit shape resize handle position, or null if a shape resize handle was not hit.

public ResizeHandlePosition? ShapeResizeHandle { get; }

Property Value

ResizeHandlePosition?

ShapeResizeHandleOwner

Gets the shape that owns a hit resize handle, or null if a shape resize handle was not hit.

public ShapeElement? ShapeResizeHandleOwner { get; }

Property Value

ShapeElement

Target

The raw target object that was hit. Use typed accessors (Node, Edge, etc.) for convenience.

public object? Target { get; init; }

Property Value

object

TargetType

The type of element that was hit.

public HitTargetType TargetType { get; init; }

Property Value

HitTargetType

Methods

CanvasHit(Point)

Creates a result indicating empty canvas was hit.

public static GraphHitTestResult CanvasHit(Point canvasPosition)

Parameters

canvasPosition Point

Returns

GraphHitTestResult

EdgeHit(Edge, Point, double)

Creates a result indicating an edge was hit.

public static GraphHitTestResult EdgeHit(Edge edge, Point canvasPosition, double distance = 0)

Parameters

edge Edge
canvasPosition Point
distance double

Returns

GraphHitTestResult

NodeHit(Node, Point, double)

Creates a result indicating a node was hit.

public static GraphHitTestResult NodeHit(Node node, Point canvasPosition, double distance = 0)

Parameters

node Node
canvasPosition Point
distance double

Returns

GraphHitTestResult

PortHit(Node, Port, bool, Point, double)

Creates a result indicating a port was hit.

public static GraphHitTestResult PortHit(Node node, Port port, bool isInput, Point canvasPosition, double distance = 0)

Parameters

node Node
port Port
isInput bool
canvasPosition Point
distance double

Returns

GraphHitTestResult

ResizeHandleHit(Node, ResizeHandlePosition, Point)

Creates a result indicating a resize handle was hit.

public static GraphHitTestResult ResizeHandleHit(Node node, ResizeHandlePosition handlePosition, Point canvasPosition)

Parameters

node Node
handlePosition ResizeHandlePosition
canvasPosition Point

Returns

GraphHitTestResult

ShapeResizeHandleHit(ShapeElement, ResizeHandlePosition, Point)

Creates a result indicating a shape resize handle was hit.

public static GraphHitTestResult ShapeResizeHandleHit(ShapeElement shape, ResizeHandlePosition handlePosition, Point canvasPosition)

Parameters

shape ShapeElement
handlePosition ResizeHandlePosition
canvasPosition Point

Returns

GraphHitTestResult