AvalonStudio.TextEditor.TextEditor.OnPointerMoved C# (CSharp) Method

OnPointerMoved() protected method

protected OnPointerMoved ( Avalonia.Input.PointerEventArgs e ) : void
e Avalonia.Input.PointerEventArgs
return void
        protected override void OnPointerMoved(PointerEventArgs e)
        {
            if (TextView != null) // Need to check this incase control was virtualized?
            {
                var point = e.GetPosition(TextView.TextSurface);

                if (e.Device.Captured == TextView)
                {
                    var currentMouseOffset = TextView.GetOffsetFromPoint(point);

                    if (currentMouseOffset != -1)
                    {
                        CaretIndex = currentMouseOffset;

                        if (CaretIndex >= 0)
                        {
                            SelectionEnd = CaretIndex;
                        }
                        else
                        {
                            SelectionEnd = 0;
                        }
                    }
                }
            }
        }