Exemplo n.º 1
0
        protected override Size ArrangeOverride(Size finalSize)
        {
            if (TextDocument != null)
            {
                GenerateTextProperties();

                Viewport = new Size(finalSize.Width, finalSize.Height / CharSize.Height);
                Extent   = new Size(finalSize.Width, LogicalScrollSize);

                InvalidateScroll.Invoke();
            }

            var result        = finalSize;
            var arrangeOffset = new Vector(Math.Floor(Offset.X) * CharSize.Width, Math.Floor(Offset.Y) * CharSize.Height);

            result = base.ArrangeOverride(new Size(result.Width, result.Height + arrangeOffset.Y));

            var child = contentPresenter as ILayoutable;

            if (child != null)
            {
                child.Arrange(new Rect((Point)(-arrangeOffset), child.DesiredSize));
            }

            return(result);
        }
Exemplo n.º 2
0
 protected override Size ArrangeOverride(Size finalSize)
 {
     _viewport = new Size(finalSize.Width, finalSize.Height / _lineSize.Height);
     _extent   = new Size(_lineSize.Width, itemCount + 1);
     InvalidateScroll?.Invoke();
     return(finalSize);
 }
Exemplo n.º 3
0
        private void GenerateVisualLines(DrawingContext context)
        {
            VisualLines.Clear();

            uint visualLineNumber = 0;

            for (var i = (int)offset.Y; i < Viewport.Height + offset.Y && i < TextDocument.LineCount && i >= 0; i++)
            {
                var line = new VisualLine {
                    DocumentLine = TextDocument.Lines[i], VisualLineNumber = visualLineNumber++
                };
                GenerateText(line);
                VisualLines.Add(line);
            }

            if (TextDocument.LineCount != lastLineCount)
            {
                lastLineCount = TextDocument.LineCount;

                InvalidateMeasure();
                InvalidateScroll?.Invoke();
            }

            invalidateVisualLines = false;
        }