Exemple #1
0
        static public IEnumerable <KeyValuePair <IUIElement, RectInt[]> > GetOccludingUIElementAndRemainingRegion(
            this IUIElement occludedElement,
            object uiTree)
        =>
        occludedElement.GetUpmostUIElementOfSubtreeInFront(uiTree)

        //	Assume that children of OccludedElement do not participate in Occlusion
        ?.Where(candidateOccluding => (occludedElement?.ChildLastInTreeIndex ?? 0) < candidateOccluding?.InTreeIndex)

        ?.Select(occludingElement => new KeyValuePair <IUIElement, RectInt[]>(
                     occludingElement, occludedElement.Region.SubstractionRemainder(occludingElement.Region).ToArray()))
        //	only take elements where the remaining region is smaller than the region of the OccludedElement.
        ?.Where(occludingElementAndRemainingRegion =>
                (occludingElementAndRemainingRegion.Value?.Select(subregion => subregion.Area())?.Sum() ?? 0) < occludedElement.Region.Area());