Skip to content

Small improvements to ListOption #89

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

Merged
merged 2 commits into from
Jul 21, 2023
Merged

Conversation

Crendgrim
Copy link
Contributor

This PR adds two small patches to ListOption<T>.

Patch 1: Allow to specify size limits for option lists.

This allows to set a "minimum" and a "maximum" length for the option list, beyond which it may not grow/shrink using the GUI. To facilitate that, the "add entry" and "remove entry" buttons are disabled whenever an operation would break these size constraints.

Patch 2: Allow "reversed" lists that add new options at their end.

ListOptions until now always grew at the top. I had the situation in my mod HaloHUD where I needed a list of entries to grow the opposite way. The workaround is quite ugly: https://github.com/Crendgrim/yaclx/blob/988aa3a7d7efbee935bb412c19681743abfa5a32/common/src/main/java/mod/crend/yaclx/auto/internal/BindingHelper.java#L98

This patch cleans that up by providing an option to the builder to manipulate this behaviour as the mod developer wishes.

This patch adds the functionality to specify a minimum and maximum size
for option lists. The buttons to add and remove entries are disabled
whenever an operation would violate these length constraints.
By default, option lists in YACL add new entries to the top. However,
this is not always the ideal behaviour. Until now, this could only be
worked around using a special binding that reverts the lists. With this
patch, it now is supported way more cleanly.
Copy link
Owner

@isXander isXander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@isXander
Copy link
Owner

Also, I'd like to see if you could PR the controllers you are working on for yaclx. Looks interesting, and could be used a lot! (only if you can get them stable enough)

@isXander isXander merged commit 8a4d6df into isXander:1.20.x/dev Jul 21, 2023
isXander pushed a commit that referenced this pull request Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants