-
Notifications
You must be signed in to change notification settings - Fork 998
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
feat(ui): Add TextArea for auto-scrollable wrapped text support #9786
feat(ui): Add TextArea for auto-scrollable wrapped text support #9786
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.
Code looks ok, I'll try to test it
Here are a few comments but I only took a quick look and dont know much about UI if I'm being honest
Edit: that showcase video looks good
So that we don't have to use the scope resolution oprerator to tell them apart.
…nto wrapped_text_buffer
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.
Just a small thing
I dont know enough about whats going on for dialog and the like to know if the inheritance is good how its currently implemented, might be good to get someone who knows about that
Probably not required to test it
Currently, the |
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.
style
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.
The dialog doesn't switch to using a TextArea when the game window is resized. Not necessarily a bug, but something that could be added for a better user experience. And I think the wide mode works the same (it's set in Dialog::Init, too), so we don't have to change it in this PR.
Co-authored-by: TomGoodIdea <108272452+TomGoodIdea@users.noreply.github.com>
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.
Thank you!
All open comments seem to be handled, and reviewers seem positive: Merging. |
Feature
Add the ability to scroll the contents of a dialog
Summary
This PR adds the
TextArea
class, along with somePanel
changes needed to support it. This class will wrap text to draw, and will automatically add controls to scroll it if needed.As an initial implementation, I have used this
TextArea
to fix an issue in theDialog
class, which at high zoom levels can cause the dialog to be taller than the screen. This is easily reproducible by using the highest ui zoom level and scanning a carrier.The
TextArea
can be used anywhere else where multiple lines of text need to be formatted and displayed, and can be modified in the future to handle RTL or BIDI text.Screenshots
Before:
![image](https://private-user-images.githubusercontent.com/9004013/302822514-b9b43f7c-0f54-4329-84da-61db7df22929.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjA1OTEyNTUsIm5iZiI6MTcyMDU5MDk1NSwicGF0aCI6Ii85MDA0MDEzLzMwMjgyMjUxNC1iOWI0M2Y3Yy0wZjU0LTQzMjktODRkYS02MWRiN2RmMjI5MjkucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDcxMCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA3MTBUMDU1NTU1WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YWE3MzlkNjZhMTdhMzZjNTZiMjU1M2IxNjhjODlhNTUwYThjMzI2NWExMjE2NzEzYmM4M2EzNWFkMjM5ZTFkMSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.-XkY9USESEbS8pnPksqN2K4rygajCJWr3aJD1W49vR4)
After:
textarea.mp4
Testing Done
Tested entry, ok-cancel, and ok dialogs using the scanner and the shop panel.
Performance Impact
This requires an extra texture allocation the same size as the dialog text, which gets freed when the dialog is dismissed. It will improve the cpu performance, as the rendered text will be cached from frame to frame if no scrolling has occurred.