Beispiel #1
0
        private static RadRect GetArrangeRect(SelectionRegionInfo region, ArrangeDataForDecorations horizontalArrangement, ArrangeDataForDecorations verticalArrangement)
        {
            double left   = -1;
            double right  = -2;
            double top    = -1;
            double bottom = -2;

            var startRowLayout = region.StartItem.RowItemInfo.LayoutInfo;
            var endRowLayout   = region.EndItem.RowItemInfo.LayoutInfo;

            var invalidInfo = new LayoutInfo {
                Line = -1
            };

            LayoutInfo startColumnLayout = region.StartItem.Column != null ? region.StartItem.Column.ItemInfo.LayoutInfo : invalidInfo;
            LayoutInfo endColumnLayout   = region.EndItem.Column != null ? region.EndItem.Column.ItemInfo.LayoutInfo : invalidInfo;

            if (IsInsideArrangement(verticalArrangement, startRowLayout, endRowLayout))
            {
                if (!verticalArrangement.TryGetStartOfSlot(startRowLayout.Line, out top) && verticalArrangement.SlotsStartLine >= startRowLayout.Line)
                {
                    top = verticalArrangement.SlotsStart;
                }

                if (!verticalArrangement.TryGetEndOfSlot(endRowLayout.Line + endRowLayout.LineSpan - 1, out bottom) && verticalArrangement.SlotsEndLine <= endRowLayout.Line)
                {
                    bottom = verticalArrangement.SlotsEnd;
                }

                if (startColumnLayout.Equals(invalidInfo) || endColumnLayout.Equals(invalidInfo) || IsInsideArrangement(horizontalArrangement, startColumnLayout, endColumnLayout))
                {
                    if (!horizontalArrangement.TryGetStartOfSlot(startColumnLayout.Line, out left) && (horizontalArrangement.SlotsStartLine >= startColumnLayout.Line || startColumnLayout.Equals(invalidInfo)))
                    {
                        left = horizontalArrangement.SlotsStart;
                    }

                    if (!horizontalArrangement.TryGetEndOfSlot(endColumnLayout.Line + endColumnLayout.LineSpan - 1, out right) && (horizontalArrangement.SlotsEndLine <= endColumnLayout.Line || endColumnLayout.Equals(invalidInfo)))
                    {
                        right = horizontalArrangement.SlotsEnd;
                    }
                }
            }

            return(new RadRect(left, top, right - left, bottom - top));
        }