Textbox Pointer Fix
I made some changes to hopefully keep the pointer in the right location.
This commit is contained in:
parent
532d212494
commit
47469e0f1a
@ -236,6 +236,13 @@ public class TextBox : UserControl
|
||||
_label.Location = _label.Location;
|
||||
}
|
||||
}
|
||||
|
||||
if (_label.Text.Length < CursorLocation)
|
||||
{
|
||||
CursorLocation = _label.Text.Length;
|
||||
var xy = _label.GetCharLocation(CursorLocation);
|
||||
Pointer.Location = new(_label.Location.X + xy.X, _label.Location.Y + xy.Y, Pointer.Location.Z);
|
||||
}
|
||||
}
|
||||
}
|
||||
public string WatermarkText
|
||||
@ -283,8 +290,8 @@ public class TextBox : UserControl
|
||||
Size = new(Size.X, Size.Y - (int)_label.Font.PixelHeight);
|
||||
if (OnRemoveLine is not null) OnRemoveLine.Invoke();
|
||||
}
|
||||
Text = Text.Remove(CursorLocation - 1, 1);
|
||||
CursorLocation--;
|
||||
Text = Text.Remove(CursorLocation, 1);
|
||||
var f = _label.GetCharLocation(CursorLocation);
|
||||
Pointer.Location = _label.Location + new Vector3i(f.X, f.Y, 0);
|
||||
Pointer.Visible = true;
|
||||
|
Loading…
Reference in New Issue
Block a user