private void EraseRange(RtAbsRange range) { Debug.Assert(range.FirstCharPos >= 0, "range.FirstCharPos >= 0"); Debug.Assert(range.LastCharPos < text.LayoutTextLength); var lastCharAbsPos = range.LastCharPos; while (lastCharAbsPos >= range.FirstCharPos) { EraseChar(lastCharAbsPos); lastCharAbsPos--; } }
public IEnumerable <AaRectangle2> GetSelectionRectangles(RtAbsRange range) { GetLspanFor(range.FirstCharPos, out var lspan1, out var lspanIndex1, out var charIndex1); GetLspanFor(range.LastCharPos + 1, out var lspan2, out var lspanIndex2, out var charIndex2); var startCorner = lspan1.Bounds.MinMin + new Vector2(lspan1.GetCharOffset(charIndex1), 0); var endCorner = lspan2.Bounds.MinMax + new Vector2(lspan2.GetCharOffset(charIndex2), 0); if (lspanIndex1 == lspanIndex2) { yield return(new AaRectangle2(startCorner, endCorner)); yield break; } yield return(new AaRectangle2(startCorner, lspan1.Bounds.MaxMax)); for (var i = lspanIndex1 + 1; i < lspanIndex2; i++) { yield return(LayoutSpans[i].Bounds); } yield return(new AaRectangle2(lspan2.Bounds.MinMin, endCorner)); }