Class InputStateContext
Shared context passed to all input states. Contains references to canvas components and raises events.
public class InputStateContext
- Inheritance
-
InputStateContext
- Inherited Members
Constructors
InputStateContext(FlowCanvasSettings, ViewportState, CanvasElementManager)
public InputStateContext(FlowCanvasSettings settings, ViewportState viewport, CanvasElementManager graphRenderer)
Parameters
settingsFlowCanvasSettingsviewportViewportStategraphRendererCanvasElementManager
Properties
ApplyViewportTransformCallback
Callback to apply viewport transforms. Set by FlowCanvas.
public Action? ApplyViewportTransformCallback { get; set; }
Property Value
CollisionProvider
Optional collision provider for preventing node overlap during drag. Applied after SnapProvider. Returns offset to prevent collision. Set by FlowCanvas.
public ICollisionProvider? CollisionProvider { get; set; }
Property Value
ConnectionValidator
Optional connection validator for validating new connections. Set by FlowCanvas.
public IConnectionValidator? ConnectionValidator { get; set; }
Property Value
Coordinates
Type-safe coordinate helper that abstracts rendering mode differences. Use this instead of ViewportToCanvas/CanvasToViewport for new code.
public IInputCoordinates Coordinates { get; }
Property Value
DirectRenderer
public DirectCanvasRenderer? DirectRenderer { get; set; }
Property Value
Dispatcher
Reference to the InputDispatcher for processor-based input handling. Set by FlowCanvas during initialization.
public InputDispatcher? Dispatcher { get; set; }
Property Value
Remarks
This enables IdleState to delegate to the InputDispatcher instead of doing manual pattern matching on source control tags.
Graph
public Graph? Graph { get; set; }
Property Value
GraphRenderer
public CanvasElementManager GraphRenderer { get; }
Property Value
MainCanvas
public Canvas? MainCanvas { get; set; }
Property Value
- Canvas
RenderTarget
Mode-agnostic render target for creating temporary visuals. Handles container selection and coordinate conversion internally.
public IRenderTarget RenderTarget { get; }
Property Value
RootPanel
public Panel? RootPanel { get; set; }
Property Value
- Panel
Settings
public FlowCanvasSettings Settings { get; }
Property Value
ShapeVisualManager
Shape visual manager for updating shape selection state. Set by FlowCanvas.
public ShapeVisualManager? ShapeVisualManager { get; set; }
Property Value
SnapProvider
Optional snap provider for providing snap offsets during drag operations. External systems (like helper lines, guides) can register as a snap provider to influence node positions during drag without directly setting positions. Set by FlowCanvas.
public ISnapProvider? SnapProvider { get; set; }
Property Value
Theme
public ThemeResources? Theme { get; set; }
Property Value
Viewport
public ViewportState Viewport { get; }
Property Value
Methods
ApplyViewportTransform()
Applies the current viewport state to the MainCanvas transform. This enables O(1) pan/zoom updates instead of O(n) re-rendering. For DirectRendering mode, triggers a redraw since it bypasses the visual tree.
public void ApplyViewportTransform()
CanvasToViewport(Point)
public Point CanvasToViewport(Point canvasPoint)
Parameters
canvasPointPoint
Returns
- Point
RaiseBoxSelectionChanged(Rect)
public void RaiseBoxSelectionChanged(Rect bounds)
Parameters
boundsRect
RaiseConnectEnd(Node?, Port?, Node?, Port?, bool)
public void RaiseConnectEnd(Node? sourceNode, Port? sourcePort, Node? targetNode, Port? targetPort, bool completed)
Parameters
RaiseConnectStart(Node, Port, bool)
public void RaiseConnectStart(Node sourceNode, Port sourcePort, bool isOutput)
Parameters
RaiseConnectionCompleted(Node, Port, Node, Port)
public void RaiseConnectionCompleted(Node sourceNode, Port sourcePort, Node targetNode, Port targetPort)
Parameters
RaiseCopy()
public void RaiseCopy()
RaiseCut()
public void RaiseCut()
RaiseDeleteSelected()
public void RaiseDeleteSelected()
RaiseDeselectAll()
public void RaiseDeselectAll()
RaiseDuplicate()
public void RaiseDuplicate()
RaiseEdgeClicked(Edge, bool)
public void RaiseEdgeClicked(Edge edge, bool ctrlHeld)
Parameters
RaiseEdgeDisconnected(Edge)
public void RaiseEdgeDisconnected(Edge edge)
Parameters
edgeEdge
RaiseEdgeLabelEditRequested(Edge, Point)
Raises the EdgeLabelEditRequested event and returns whether it was handled.
public bool RaiseEdgeLabelEditRequested(Edge edge, Point screenPosition)
Parameters
edgeEdgescreenPositionPoint
Returns
RaiseEdgeReconnected(Edge, Edge)
public void RaiseEdgeReconnected(Edge oldEdge, Edge newEdge)
Parameters
RaiseGridRender()
public void RaiseGridRender()
RaiseGroup()
public void RaiseGroup()
RaiseGroupCollapseToggle(string)
public void RaiseGroupCollapseToggle(string groupId)
Parameters
groupIdstring
RaiseNodeDragStart(IReadOnlyList<Node>, Point)
public void RaiseNodeDragStart(IReadOnlyList<Node> nodes, Point startPosition)
Parameters
nodesIReadOnlyList<Node>startPositionPoint
RaiseNodeDragStop(IReadOnlyList<Node>, bool)
public void RaiseNodeDragStop(IReadOnlyList<Node> nodes, bool cancelled)
Parameters
nodesIReadOnlyList<Node>cancelledbool
RaiseNodeLabelEditRequested(Node, Point)
Raises the NodeLabelEditRequested event and returns whether it was handled.
public bool RaiseNodeLabelEditRequested(Node node, Point screenPosition)
Parameters
nodeNodescreenPositionPoint
Returns
RaiseNodeResized(Node, double, double, double, double, Point, Point)
public void RaiseNodeResized(Node node, double oldWidth, double oldHeight, double newWidth, double newHeight, Point oldPos, Point newPos)
Parameters
nodeNodeoldWidthdoubleoldHeightdoublenewWidthdoublenewHeightdoubleoldPosPointnewPosPoint
RaiseNodeResizing(Node, double, double, Point)
public void RaiseNodeResizing(Node node, double newWidth, double newHeight, Point newPos)
Parameters
RaiseNodesDragged(Dictionary<string, Point>, Dictionary<string, Point>)
public void RaiseNodesDragged(Dictionary<string, Point> oldPositions, Dictionary<string, Point> newPositions)
Parameters
oldPositionsDictionary<string, Point>newPositionsDictionary<string, Point>
RaiseNodesDragging(IReadOnlyList<string>)
public void RaiseNodesDragging(IReadOnlyList<string> nodeIds)
Parameters
nodeIdsIReadOnlyList<string>
RaisePaste()
public void RaisePaste()
RaiseRedo()
public void RaiseRedo()
RaiseSelectAll()
public void RaiseSelectAll()
RaiseSelectionChanged()
public void RaiseSelectionChanged()
RaiseShapeResized(ShapeElement, double, double, double, double, Point, Point)
Raises the ShapeResized event after shape resize is complete.
public void RaiseShapeResized(ShapeElement shape, double oldWidth, double oldHeight, double newWidth, double newHeight, Point oldPos, Point newPos)
Parameters
shapeShapeElementoldWidthdoubleoldHeightdoublenewWidthdoublenewHeightdoubleoldPosPointnewPosPoint
RaiseShapeResizing(ShapeElement, double, double, Point)
Raises the ShapeResizing event during shape resize operation.
public void RaiseShapeResizing(ShapeElement shape, double newWidth, double newHeight, Point newPos)
Parameters
shapeShapeElementnewWidthdoublenewHeightdoublenewPosPoint
RaiseShapeTextEditRequested(ShapeElement, Point)
Raises the ShapeTextEditRequested event and returns whether it was handled.
public bool RaiseShapeTextEditRequested(ShapeElement shape, Point screenPosition)
Parameters
shapeShapeElementscreenPositionPoint
Returns
RaiseStateChanged(string, string)
public void RaiseStateChanged(string oldState, string newState)
Parameters
RaiseUndo()
public void RaiseUndo()
RaiseUngroup()
public void RaiseUngroup()
UpdateSettings(FlowCanvasSettings)
Updates the settings used by this context.
public void UpdateSettings(FlowCanvasSettings settings)
Parameters
settingsFlowCanvasSettingsThe new settings to use.
ViewportToCanvas(Point)
public Point ViewportToCanvas(Point viewportPoint)
Parameters
viewportPointPoint
Returns
- Point
Events
BoxSelectionChanged
public event EventHandler<BoxSelectionEventArgs>? BoxSelectionChanged
Event Type
ConnectEnd
public event EventHandler<ConnectEndEventArgs>? ConnectEnd
Event Type
ConnectStart
public event EventHandler<ConnectStartEventArgs>? ConnectStart
Event Type
ConnectionCompleted
public event EventHandler<ConnectionCompletedEventArgs>? ConnectionCompleted
Event Type
CopyRequested
public event EventHandler? CopyRequested
Event Type
CutRequested
public event EventHandler? CutRequested
Event Type
DeleteSelectedRequested
public event EventHandler? DeleteSelectedRequested
Event Type
DeselectAllRequested
public event EventHandler? DeselectAllRequested
Event Type
DuplicateRequested
public event EventHandler? DuplicateRequested
Event Type
EdgeClicked
public event EventHandler<EdgeClickedEventArgs>? EdgeClicked
Event Type
EdgeDisconnected
public event EventHandler<EdgeDisconnectedEventArgs>? EdgeDisconnected
Event Type
EdgeLabelEditRequested
public event EventHandler<EdgeLabelEditRequestedEventArgs>? EdgeLabelEditRequested
Event Type
EdgeReconnected
public event EventHandler<EdgeReconnectedEventArgs>? EdgeReconnected
Event Type
GridRenderRequested
public event EventHandler? GridRenderRequested
Event Type
GroupCollapseToggleRequested
public event EventHandler<GroupToggleCollapseEventArgs>? GroupCollapseToggleRequested
Event Type
GroupRequested
public event EventHandler? GroupRequested
Event Type
NodeDragStart
public event EventHandler<NodeDragStartEventArgs>? NodeDragStart
Event Type
NodeDragStop
public event EventHandler<NodeDragStopEventArgs>? NodeDragStop
Event Type
NodeLabelEditRequested
public event EventHandler<NodeLabelEditRequestedEventArgs>? NodeLabelEditRequested
Event Type
NodeResized
public event EventHandler<NodeResizedEventArgs>? NodeResized
Event Type
NodeResizing
public event EventHandler<NodeResizingEventArgs>? NodeResizing
Event Type
NodesDragged
public event EventHandler<NodesDraggedEventArgs>? NodesDragged
Event Type
NodesDragging
public event EventHandler<NodesDraggingEventArgs>? NodesDragging
Event Type
PasteRequested
public event EventHandler? PasteRequested
Event Type
RedoRequested
public event EventHandler? RedoRequested
Event Type
SelectAllRequested
public event EventHandler? SelectAllRequested
Event Type
SelectionChangeRequested
public event EventHandler? SelectionChangeRequested
Event Type
ShapeResized
public event EventHandler<ShapeResizedEventArgs>? ShapeResized
Event Type
ShapeResizing
public event EventHandler<ShapeResizingEventArgs>? ShapeResizing
Event Type
ShapeTextEditRequested
public event EventHandler<ShapeTextEditRequestedEventArgs>? ShapeTextEditRequested
Event Type
StateChanged
public event EventHandler<StateChangedEventArgs>? StateChanged
Event Type
UndoRequested
public event EventHandler? UndoRequested
Event Type
UngroupRequested
public event EventHandler? UngroupRequested