CK.WindowManager.Model.HitTester.GetIntersectionArea C# (CSharp) Method

GetIntersectionArea() private static method

private static GetIntersectionArea ( ISpatialBinding binding, Rect>.IDictionary setToChallenge, Rect rect, Rect &enlargedRectangle, IWindowElement &otherWindow ) : Rect
binding ISpatialBinding
setToChallenge Rect>.IDictionary
rect System.Windows.Rect
enlargedRectangle System.Windows.Rect
otherWindow IWindowElement
return System.Windows.Rect
        private static Rect GetIntersectionArea( ISpatialBinding binding, IDictionary<IWindowElement, Rect> setToChallenge, Rect rect, ref Rect enlargedRectangle, out IWindowElement otherWindow )
        {
            ICollection<IWindowElement> boundWindows = binding.AllDescendants().Select( x => x.Window ).ToArray();
            otherWindow = null;
            Rect rectWindow = setToChallenge[binding.Window];
            foreach( var item in setToChallenge )
            {
                otherWindow = item.Key;
                // If in all registered windows a window intersect with the one that moved
                if( otherWindow != binding.Window && !boundWindows.Contains( otherWindow ) )
                {
                    rect = setToChallenge[otherWindow];
                    if( !rectWindow.IntersectsWith( rect ) && rect.IntersectsWith( enlargedRectangle ) ) return Rect.Intersect( enlargedRectangle, rect );
                }
            }
            return Rect.Empty;
        }