14 KiB
Connector Class
Namespace: Nodify
Assembly: Nodify
Inheritance: Object → DispatcherObject → DependencyObject → Visual → UIElement → FrameworkElement → Control → Connector
Derived: NodeInput, NodeOutput, StateNode
References: ConnectorState.Connecting, Connection, ConnectorEventArgs, ConnectorEventHandler, ConnectorState.Default, ConnectorState.Disconnect, InputProcessor, ItemContainer, KnotNode, Node, NodifyEditor, PendingConnection, PendingConnectionEventArgs, PendingConnectionEventHandler
Represents a connector control that can start and complete a PendingConnection. Has a Connector.ElementConnector that the Connector.Anchor is calculated from for the PendingConnection. Center of this control is used if missing.
public class Connector : Control
Constructors
Connector()
public Connector();
Fields
ElementConnector
protected const string ElementConnector = "PART_Connector";
Field Value
EnableOptimizations
Gets or sets if Connectors should enable optimizations based on Connector.OptimizeSafeZone and Connector.OptimizeMinimumSelectedItems.
public static bool EnableOptimizations;
Field Value
OptimizeMinimumSelectedItems
Gets or sets the minimum selected items needed to trigger optimizations when outside of the Connector.OptimizeSafeZone.
public static uint OptimizeMinimumSelectedItems;
Field Value
OptimizeSafeZone
Gets or sets the safe zone outside the editor's viewport that will not trigger optimizations.
public static double OptimizeSafeZone;
Field Value
Properties
AllowPendingConnectionCancellation
Gets or sets whether cancelling a pending connection is allowed.
public static bool AllowPendingConnectionCancellation { get; set; }
Property Value
Anchor
Gets the location in graph space coordinates where Connections can be attached to. Bind with System.Windows.Data.BindingMode.OneWayToSource
public Point Anchor { get; set; }
Property Value
Container
Gets the ItemContainer that contains this Connector.
public ItemContainer Container { get; set; }
Property Value
DisconnectCommand
Invoked if the Connector.Disconnect event is not handled. Parameter is the FrameworkElement.DataContext of this control.
public ICommand DisconnectCommand { get; set; }
Property Value
Editor
Gets the NodifyEditor that owns this Connector.Container.
public NodifyEditor Editor { get; set; }
Property Value
HasContextMenu
Gets a value indicating whether the connector has a context menu.
public bool HasContextMenu { get; set; }
Property Value
HasCustomContextMenu
Gets or sets a value indicating whether the connector uses a custom context menu.
public bool HasCustomContextMenu { get; set; }
Property Value
InputProcessor
protected InputProcessor InputProcessor { get; set; }
Property Value
IsConnected
If this is set to false, the Connector.Disconnect event will not be invoked and the connector will stop updating its Connector.Anchor when moved, resized etc.
public bool IsConnected { get; set; }
Property Value
IsPendingConnection
Gets a value that indicates whether a PendingConnection is in progress for this Connector.
public bool IsPendingConnection { get; protected set; }
Property Value
Methods
BeginConnecting()
Initiates a new pending connection from this connector with the specified offset (see Connector.IsPendingConnection).
public void BeginConnecting();
BeginConnecting(Vector)
public void BeginConnecting(Vector offset);
Parameters
offset Vector
CancelConnecting()
Cancels the current pending connection without completing it if Connector.AllowPendingConnectionCancellation is true. Otherwise, it completes the pending connection by calling Nodify.Connector.EndConnecting.
public void CancelConnecting();
EndConnecting()
Completes the current pending connection using the specified connector as the target.
public void EndConnecting();
EndConnecting(Connector)
public void EndConnecting(Connector connector);
Parameters
connector Connector
FindConnectionTarget(Point)
Searches for a potential Connector or ItemContainer at the specified position within the editor.
public FrameworkElement FindConnectionTarget(Point position);
Parameters
position Point: The position in the editor to check for a potential connection target.
Returns
FindTargetConnector(Point)
Searches for a Connector at the specified position.
public Connector FindTargetConnector(Point position);
Parameters
position Point: The position in the editor to check for a connector.
Returns
OnApplyTemplate()
public override void OnApplyTemplate();
OnKeyDown(KeyEventArgs)
protected override void OnKeyDown(KeyEventArgs e);
Parameters
OnKeyUp(KeyEventArgs)
protected override void OnKeyUp(KeyEventArgs e);
Parameters
OnLostMouseCapture(MouseEventArgs)
protected override void OnLostMouseCapture(MouseEventArgs e);
Parameters
OnMouseDown(MouseButtonEventArgs)
protected override void OnMouseDown(MouseButtonEventArgs e);
Parameters
OnMouseMove(MouseEventArgs)
protected override void OnMouseMove(MouseEventArgs e);
Parameters
OnMouseUp(MouseButtonEventArgs)
protected override void OnMouseUp(MouseButtonEventArgs e);
Parameters
OnMouseWheel(MouseWheelEventArgs)
protected override void OnMouseWheel(MouseWheelEventArgs e);
Parameters
OnRenderSizeChanged(SizeChangedInfo)
protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo);
Parameters
sizeInfo SizeChangedInfo
RemoveConnections()
Removes all connections associated with this connector.
public void RemoveConnections();
UpdateAnchor(Point)
Updates the Connector.Anchor relative to a location. (usually Connector.Container's location)
protected void UpdateAnchor(Point location);
Parameters
location Point: The relative location
UpdateAnchor()
Updates the Connector.Anchor based on Connector.Container's location.
public void UpdateAnchor();
UpdateAnchorOptimized(Point)
Updates the Connector.Anchor and applies optimizations if needed based on Connector.EnableOptimizations flag
protected void UpdateAnchorOptimized(Point location);
Parameters
location Point
UpdatePendingConnection(Vector)
Updates the endpoint of the pending connection by adjusting its position with the specified offset.
public void UpdatePendingConnection(Vector offset);
Parameters
offset Vector: The amount to adjust the pending connection's endpoint.
UpdatePendingConnection(Point)
Updates the endpoint of the pending connection to the specified position.
public void UpdatePendingConnection(Point position);
Parameters
position Point: The new position for the connection's endpoint.
Events
Disconnect
Triggered by the Nodify.Interactivity.EditorGestures.ConnectorGestures.Disconnect gesture.
public event ConnectorEventHandler Disconnect;
Event Type
PendingConnectionCompleted
Triggered by the Nodify.Interactivity.EditorGestures.ConnectorGestures.Connect gesture.
public event PendingConnectionEventHandler PendingConnectionCompleted;
Event Type
PendingConnectionDrag
Occurs when the mouse is changing position and the Connector has mouse capture.
public event PendingConnectionEventHandler PendingConnectionDrag;
Event Type
PendingConnectionStarted
Triggered by the Nodify.Interactivity.EditorGestures.ConnectorGestures.Connect gesture.
public event PendingConnectionEventHandler PendingConnectionStarted;
Event Type