-
Notifications
You must be signed in to change notification settings - Fork 40
Fix text alignment not working with TextFieldWidget #150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it still work properly when the text becomes long so that the scrollbar appears?
src/main/java/com/cleanroommc/modularui/widgets/textfield/TextFieldWidget.java
Outdated
Show resolved
Hide resolved
No. i cant even enter text longer than the field with the change, somehow didnt pick this up in testing looking at it further it appears thats because of this check in if (this.maxWidth < getFontRenderer().getStringWidth(line)) {
return false;
} where returning false stops the text from being inserted into the TextField. not sure how to fix this |
going to mark this pr as draft cuz fixing the issue properly is alot more involved than i thought it would be |
Unmarking this as draft because testing in game shows everything working and rendering fine even when the field has to scroll |
# Conflicts: # src/main/java/com/cleanroommc/modularui/test/TestTile.java # src/main/java/com/cleanroommc/modularui/widgets/textfield/TextFieldWidget.java
* do the fix * add test * horizontal * fix a few bugs * comment & bool for checking width --------- Co-authored-by: brachy84 <brachy84@gmail.com> (cherry picked from commit 35d0b44)
I did my testing using TestTile, modifying the
TextFieldWidget
s at L249 & L254 to have a.setTextAlignment(Alignment.Center)
.Before fix

Still on the left despite using
Alignment.Center
After fix

Now centered!!