mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-22 20:58:34 +01:00
fixed text fields sometimes not updating their length correctly
This commit is contained in:
parent
2d7da2b9aa
commit
72efe55970
1 changed files with 1 additions and 1 deletions
|
@ -43,7 +43,7 @@ namespace MLEM.Ui.Elements {
|
||||||
var length = this.font.MeasureString(this.Text).X * this.TextScale;
|
var length = this.font.MeasureString(this.Text).X * this.TextScale;
|
||||||
var maxWidth = this.DisplayArea.Width - this.TextOffsetX * 2;
|
var maxWidth = this.DisplayArea.Width - this.TextOffsetX * 2;
|
||||||
if (length > maxWidth) {
|
if (length > maxWidth) {
|
||||||
for (var i = Math.Max(0, this.textStartIndex - 1); i < this.Text.Length; i++) {
|
for (var i = 0; i < this.Text.Length; i++) {
|
||||||
var substring = this.Text.ToString(i, this.Text.Length - i);
|
var substring = this.Text.ToString(i, this.Text.Length - i);
|
||||||
if (this.font.MeasureString(substring).X * this.TextScale <= maxWidth) {
|
if (this.font.MeasureString(substring).X * this.TextScale <= maxWidth) {
|
||||||
this.textStartIndex = i;
|
this.textStartIndex = i;
|
||||||
|
|
Loading…
Reference in a new issue