public override void MouseDown(NSEvent theEvent) { base.MouseDown(theEvent); CurrentStartNode = GetInteractingNodePort(); if (CurrentStartNode != null) { SetNodeColors(); SetDrawingLayerColor(); CurrentStartPosition = CurrentStartNode.GetNodePortMidPoint(); CurrentStartNode.SetHasConnection(true); } }
void SetDefaultConnections() { var settings = SynthSettings.Instance; var sourceNodes = Nodes.Where(n => n is SourceNodeView); var targetNodes = Nodes.Where(n => n is TargetNodeView); foreach (var targetModifier in Enum.GetValues(typeof(TargetModifier)).Cast <TargetModifier>()) { var source = settings.GetSourceForTarget(targetModifier); CurrentStartNode = sourceNodes.First(n => (n as SourceNodeView).ColorComponent == source); CurrentEndNode = targetNodes.First(n => (n as TargetNodeView).TargetModifier == targetModifier); CurrentStartPosition = CurrentStartNode.GetNodePortMidPoint(); CurrentEndPosition = CurrentEndNode.GetNodePortMidPoint(); ValidConnectionMade(); } }
public abstract bool CanConnectToNode(BaseNodeView other);
void ResetDragStates() { DrawingLayer.Path = null; CurrentStartPosition = CurrentEndPosition = new CGPoint(0, 0); CurrentStartNode = CurrentEndNode = null; }
public override bool CanConnectToNode(BaseNodeView other) { return (other != this && other is TargetNodeView); }