Example #1
0
        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();
            }
        }
Example #2
0
        public override void MouseUp(NSEvent theEvent)
        {
            base.MouseUp(theEvent);

            CurrentEndNode = GetInteractingNodePort();

            if (IsDrawing && IsPendingConnectionValid())
            {
                CurrentEndPosition = CurrentEndNode.GetNodePortMidPoint();
                ValidConnectionMade();
            }
            else
            {
                NoConnectionMade();
            }

            SetNodeColors();
            SetDrawingLayerColor();
            ResetDragStates();
        }