Exemple #1
0
        // Token: 0x060072C7 RID: 29383 RVA: 0x0020F7F0 File Offset: 0x0020D9F0
        internal static void BringRectIntoViewMinimally(ITextView textView, Rect rect)
        {
            IScrollInfo scrollInfo = textView.RenderScope as IScrollInfo;

            if (scrollInfo != null)
            {
                Rect rect2 = new Rect(scrollInfo.HorizontalOffset, scrollInfo.VerticalOffset, scrollInfo.ViewportWidth, scrollInfo.ViewportHeight);
                rect.X += rect2.X;
                rect.Y += rect2.Y;
                double num  = ScrollContentPresenter.ComputeScrollOffsetWithMinimalScroll(rect2.Left, rect2.Right, rect.Left, rect.Right);
                double num2 = ScrollContentPresenter.ComputeScrollOffsetWithMinimalScroll(rect2.Top, rect2.Bottom, rect.Top, rect.Bottom);
                scrollInfo.SetHorizontalOffset(num);
                scrollInfo.SetVerticalOffset(num2);
                FrameworkElement frameworkElement = FrameworkElement.GetFrameworkParent(textView.RenderScope) as FrameworkElement;
                if (frameworkElement != null)
                {
                    if (scrollInfo.ViewportWidth > 0.0)
                    {
                        rect.X -= num;
                    }
                    if (scrollInfo.ViewportHeight > 0.0)
                    {
                        rect.Y -= num2;
                    }
                    frameworkElement.BringIntoView(rect);
                    return;
                }
            }
            else
            {
                ((FrameworkElement)textView.RenderScope).BringIntoView(rect);
            }
        }