TextAddin.Controls.VisualLine.GetTextLocation C# (CSharp) Method

GetTextLocation() public method

public GetTextLocation ( float x ) : TextLocation
x float
return TextLocation
        public TextLocation GetTextLocation(float x)
        {
            var text = TextLayer.Document.GetText(DocumentLine.Offset, DocumentLine.Length);

            int index;
            TextRenderer.GetPositionTextIndex(text, Skin.DefaultFont, x, out index);

            Console.WriteLine(index);

            //Line and Column indexes start at 1
            return new TextLocation(DocumentLine.LineNumber,index+1);
        }