예제 #1
0
        public SnapshotPoint?GetBufferPositionFromXCoordinate(double xCoordinate, bool textOnly)
        {
            if (!IsValid)
            {
                throw new ObjectDisposedException(nameof(WpfTextViewLine));
            }
            if (xCoordinate < TextLeft)
            {
                return(null);
            }
            if (xCoordinate >= TextLeft + Width)
            {
                return(null);
            }
            if (xCoordinate >= TextRight)
            {
                return(End);
            }

            Debug.Assert(TextLines.Count == 1);
            double extra  = TextLeft;
            var    column = TextLine.GetCharacterHitFromDistance(xCoordinate - extra).FirstCharacterIndex;

            return(linePartsCollection.ConvertColumnToBufferPosition(column, includeHiddenPositions: !textOnly));
        }
예제 #2
0
 public SnapshotPoint ConvertColumnToBufferPosition(int column) => linePartsCollection.ConvertColumnToBufferPosition(column);