Browse Source
Merge pull request #5115 from MarchingCube/fix-textbox-pointermove-crashes
Fix TextBox crashing when PointerMoved gets called
pull/5154/head
Dariusz Komosiński
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
4 additions and
1 deletions
-
src/Avalonia.Controls/TextBox.cs
|
|
|
@ -867,7 +867,10 @@ namespace Avalonia.Controls |
|
|
|
{ |
|
|
|
var point = e.GetPosition(_presenter); |
|
|
|
|
|
|
|
point = new Point(MathUtilities.Clamp(point.X, 0, _presenter.Bounds.Width - 1), MathUtilities.Clamp(point.Y, 0, _presenter.Bounds.Height - 1)); |
|
|
|
point = new Point( |
|
|
|
MathUtilities.Clamp(point.X, 0, Math.Max(_presenter.Bounds.Width - 1, 0)), |
|
|
|
MathUtilities.Clamp(point.Y, 0, Math.Max(_presenter.Bounds.Height - 1, 0))); |
|
|
|
|
|
|
|
CaretIndex = SelectionEnd = _presenter.GetCaretIndex(point); |
|
|
|
} |
|
|
|
} |
|
|
|
|