Table of Contents

Interface IGraphHitTester

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

Hit tester for the entire graph surface. Aggregates hit tests across all element types with proper priority ordering.

Hit Test Priority Order (first match wins):

  1. Resize handles (highest priority - always on top)
  2. Ports (small targets need priority)
  3. Nodes (front to back by Z-order)
  4. Edges (may need tolerance-based hit testing)
  5. Groups (behind their contents)
  6. Canvas (empty space, lowest priority)

Inspired by:

  • react-diagrams: DiagramEngine.getModelAtPosition() with type filtering
  • Konva.js: Stage.getIntersection() returning topmost shape
  • draw.io/mxGraph: mxGraph.getCellAt() with priority handling
public interface IGraphHitTester

Properties

InputCoordinateSpace

The coordinate space expected for hit test inputs.

Standard implementations expect Canvas coordinates. Callers using screen coordinates (e.g., from pointer events) must convert using ScreenToCanvas(double, double) first.

CoordinateSpace InputCoordinateSpace { get; }

Property Value

CoordinateSpace

Methods

HitTest(Point)

Performs a comprehensive hit test against all graph elements.

GraphHitTestResult HitTest(Point position)

Parameters

position Point

Position to test in the coordinate space specified by InputCoordinateSpace.

Returns

GraphHitTestResult

The hit test result identifying what was hit. If nothing specific was hit, returns a result with Canvas.

HitTest(Point, params HitTargetType[])

Performs a hit test filtering to specific element types.

GraphHitTestResult HitTest(Point position, params HitTargetType[] targetTypes)

Parameters

position Point

Position to test.

targetTypes HitTargetType[]

Which element types to consider.

Returns

GraphHitTestResult

The hit test result, only matching specified types.

HitTest(Point, double, double, double)

Performs a hit test with custom tolerance values.

GraphHitTestResult HitTest(Point position, double nodeTolerance = 0, double edgeTolerance = 5, double portTolerance = 8)

Parameters

position Point

Position to test.

nodeTolerance double

Extra tolerance for node bounds.

edgeTolerance double

Extra tolerance for edge paths.

portTolerance double

Extra tolerance for port targets.

Returns

GraphHitTestResult

The hit test result.