Skip to content
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

Add scrollbar to panel manager #54545

Merged
merged 3 commits into from
Jan 19, 2022

Conversation

dseguin
Copy link
Member

@dseguin dseguin commented Jan 18, 2022

Summary

None

Purpose of change

Fixes #54532.
The list of widgets in the panel manager is getting long enough to overflow the available drawing space.

Describe the solution

Add a scrollbar to the panel list. This is complicated by 2 things:

  1. The panel manager is drawn as a single window, with the elements not necessarily grouped together.
  2. The player can select and move a panel up and down the list, which relies on offsetting the other panels.
2022-01-18.16-38-25.mp4

TODO:

  • Refactor the panel manager window into 3 separate windows
  • Add a scrollbar to the left panel list
  • Make the offsets follow the drawn portion when moving a panel
  • Testing

Describe alternatives you've considered

Lengthening the panel manager window? The linked issue already explained why that's not a sustainable solution.

Testing

(See video above)

  1. Added many new layouts to the custom sidebar config.
  2. Open the panel manager and scroll up and down.
  3. Press Enter to start moving a panel and scroll up and down.
  4. Swap between lists with Right/Left.
  5. Pressing Tab enables/disables the correct widgets/panels anywhere in the list
  6. Switching sidebars still works the same.

Additional context

I thought it would be easy just to slap on a scrollbar, turns out it's a bit more complex :P

@github-actions github-actions bot added json-styled JSON lint passed, label assigned by github actions astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions labels Jan 18, 2022
@PatrikLundell
Copy link
Contributor

Do you need to handle the case that a sidebar name wraps around (in which case number of items can be less than number of lines), or does it get truncated when getting too long to fit in the panel?

@wapcaplet wapcaplet added <Bugfix> This is a fix for a bug (or closes open issue) Info / User Interface Game - player communication, menus, etc. labels Jan 18, 2022
@dseguin
Copy link
Member Author

dseguin commented Jan 18, 2022

Do you need to handle the case that a sidebar name wraps around (in which case number of items can be less than number of lines), or does it get truncated when getting too long to fit in the panel?

If by that you mean making the window width dynamic to fit the text, then probably not. I can truncate the text with an ellipsis, sort of like how widgets handle it. Currently the text is cut-off if it's too long.

@PatrikLundell
Copy link
Contributor

The problem I was asking about was if the text was wrapped around when the description wouldn't fit, as that complicates the scrollbar handling.
If "Silly widget with a really stupid name that does even more stupid things" was to be displayed as something like
"Silly widget with a really stupid name"
"that does even more stupid things"
the scrollbar would have to account for multi line entries, not just the fixed text at the top. I've encountered that problem in the past, and I think someone else is currently dealing with that kind of issue, which is why I asked. Truncation and ellipses both avoid this problem, so you should be safe from that.

@dseguin dseguin force-pushed the panel_adm_scrollbar branch from 22818e8 to 7771c0d Compare January 18, 2022 21:41
@dseguin dseguin force-pushed the panel_adm_scrollbar branch from 7771c0d to 7267bad Compare January 18, 2022 21:52
@dseguin dseguin marked this pull request as ready for review January 18, 2022 22:40
@wapcaplet
Copy link
Contributor

Works great!

@kevingranade kevingranade merged commit 00c63ec into CleverRaven:master Jan 19, 2022
@dseguin dseguin deleted the panel_adm_scrollbar branch January 19, 2022 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions <Bugfix> This is a fix for a bug (or closes open issue) Info / User Interface Game - player communication, menus, etc. json-styled JSON lint passed, label assigned by github actions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom sidebar section list needs a scrollbar
4 participants