// ---------------------------------------------------------------------- static Vector2 BindingDirectionFromTo(iCS_EditorObject port, iCS_EditorObject to, iCS_IStorage storage) { // Don't compute complex tangents if we don't have a proper parent. iCS_EditorObject portParent = port.ParentNode; if (port.IsFloating || to.IsFloating) { if (port.IsDataOrControlPort || !portParent.IsPositionOnEdge(port.AnimatedPosition, port.Edge)) { Vector2 fromPos = port.AnimatedPosition; Vector2 toPos = to.AnimatedPosition; return(GetBestDirectionFrom((toPos - fromPos).normalized)); } } if (port.IsOutTransitionPort && portParent.IsIconizedOnDisplay) { return(storage.GetTransitionPackageVector(portParent)); } if (port.IsInTransitionPort && portParent.IsIconizedOnDisplay) { return(-storage.GetTransitionPackageVector(portParent)); } Vector2 direction; if (port.IsOnLeftEdge) { direction = LeftDirection; } else if (port.IsOnRightEdge) { direction = RightDirection; } else if (port.IsOnTopEdge) { direction = UpDirection; } else { direction = DownDirection; } // Inverse direction for connection between nested nodes. iCS_EditorObject toParent = to.ParentNode; if (storage.IsChildOf(toParent, portParent) && !port.IsInStatePort) { direction = -direction; } return(direction); }