Table of Contents

Class ElementHitInfo

Namespace
FlowGraph.Core.Elements
Assembly
FlowGraph.Core.dll

Unified hit test result for all canvas elements. Used for standardized tagging of controls and hit test payloads across both visual-tree and direct-rendering modes.

public sealed class ElementHitInfo
Inheritance
ElementHitInfo
Inherited Members

Remarks

This replaces disparate tagging approaches: - Control.Tag = Node - Control.Tag = Edge - Control.Tag = (Node, Port, bool)

With a single unified payload that supports all element types and handles.

Constructors

ElementHitInfo(ICanvasElement)

Creates a hit info for a simple element (node, edge, shape).

public ElementHitInfo(ICanvasElement element)

Parameters

element ICanvasElement

ElementHitInfo(ICanvasElement, string)

Creates a hit info for an element with a handle (e.g., resize handle).

public ElementHitInfo(ICanvasElement element, string handle)

Parameters

element ICanvasElement
handle string

ElementHitInfo(Node, string, bool)

Creates a hit info for a node port.

public ElementHitInfo(Node node, string portId, bool isOutput)

Parameters

node Node
portId string
isOutput bool

Properties

AsEdge

Convenience property: gets the element as an Edge if applicable.

public Edge? AsEdge { get; }

Property Value

Edge

AsNode

Convenience property: gets the element as a Node if applicable.

public Node? AsNode { get; }

Property Value

Node

AsShape

Convenience property: gets the element as a ShapeElement if applicable.

public ShapeElement? AsShape { get; }

Property Value

ShapeElement

Element

The canvas element that was hit.

public ICanvasElement Element { get; }

Property Value

ICanvasElement

Handle

Optional handle identifier (e.g., "resize", "rotate"). Null if the main element was hit.

public string? Handle { get; }

Property Value

string

IsHandle

Convenience property: true if this is a handle hit.

public bool IsHandle { get; }

Property Value

bool

IsOutputPort

For port hits, indicates whether this is an output port (true) or input port (false).

public bool IsOutputPort { get; }

Property Value

bool

IsPort

Convenience property: true if this is a port hit.

public bool IsPort { get; }

Property Value

bool

PortId

Optional port identifier for node port hits. Null if not a port hit.

public string? PortId { get; }

Property Value

string

Methods

FromElement(ICanvasElement)

Creates an ElementHitInfo for a regular element hit.

public static ElementHitInfo FromElement(ICanvasElement element)

Parameters

element ICanvasElement

Returns

ElementHitInfo

FromHandle(ICanvasElement, string)

Creates an ElementHitInfo for an element handle hit.

public static ElementHitInfo FromHandle(ICanvasElement element, string handle)

Parameters

element ICanvasElement
handle string

Returns

ElementHitInfo

FromPort(Node, string, bool)

Creates an ElementHitInfo for a node port hit.

public static ElementHitInfo FromPort(Node node, string portId, bool isOutput)

Parameters

node Node
portId string
isOutput bool

Returns

ElementHitInfo

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.