Пример #1
0
        /// <summary>
        /// Remove the glyphs covered by <paramref name="snapshotSpan"/>.
        /// It should only be called by UI thread because UI elements are manipulated by this method.
        /// </summary>
        public void RemoveGlyphs(SnapshotSpan snapshotSpan)
        {
            AssertIsForeground();
            var glyphDataToRemove = _glyphDataTree.GetIntervalsThatIntersectWith(snapshotSpan.Start, snapshotSpan.Length);

            foreach (var(_, glyph) in glyphDataToRemove)
            {
                _glyphsContainer.Children.Remove(glyph);
            }

            var remainingGlyphData = _glyphDataTree.Except(glyphDataToRemove).ToImmutableArray();

            _glyphDataTree.ClearInPlace();
            foreach (var glyphData in remainingGlyphData)
            {
                _glyphDataTree.AddIntervalInPlace(glyphData);
            }
        }