diff options
author | Crendgrim <Crendgrim@users.noreply.github.com> | 2023-07-21 23:57:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-21 22:57:05 +0100 |
commit | 8a4d6df67917fee4b600cfad1afb7d39a75d75f1 (patch) | |
tree | c89cad79d18a5a86e5709e42b8d6129b43f54d7f /common/src/main/java/dev/isxander/yacl3/gui | |
parent | a25e2d754ae856c0c9d2c8ebb9ea16a7a458cf04 (diff) | |
download | YetAnotherConfigLib-8a4d6df67917fee4b600cfad1afb7d39a75d75f1.tar.gz YetAnotherConfigLib-8a4d6df67917fee4b600cfad1afb7d39a75d75f1.tar.bz2 YetAnotherConfigLib-8a4d6df67917fee4b600cfad1afb7d39a75d75f1.zip |
Small improvements to ListOption (#89)
Diffstat (limited to 'common/src/main/java/dev/isxander/yacl3/gui')
-rw-r--r-- | common/src/main/java/dev/isxander/yacl3/gui/OptionListWidget.java | 4 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl3/gui/controllers/ListEntryWidget.java | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/common/src/main/java/dev/isxander/yacl3/gui/OptionListWidget.java b/common/src/main/java/dev/isxander/yacl3/gui/OptionListWidget.java index 54d58f4..3197c44 100644 --- a/common/src/main/java/dev/isxander/yacl3/gui/OptionListWidget.java +++ b/common/src/main/java/dev/isxander/yacl3/gui/OptionListWidget.java @@ -485,7 +485,7 @@ public class OptionListWidget extends ElementListWidgetExt<OptionListWidget.Entr this.addListButton = new TooltipButtonWidget(yaclScreen, resetListButton.getX() - 20, -50, 20, 20, Component.literal("+"), Component.translatable("yacl.list.add_top"), btn -> { - group.insertNewEntryToTop(); + group.insertNewEntry(); setExpanded(true); }); @@ -519,7 +519,7 @@ public class OptionListWidget extends ElementListWidgetExt<OptionListWidget.Entr super.updateExpandMinimizeText(); expandMinimizeButton.active = listOption == null || listOption.available(); if (addListButton != null) - addListButton.active = expandMinimizeButton.active; + addListButton.active = expandMinimizeButton.active && listOption.numberOfEntries() < listOption.maximumNumberOfEntries(); } @Override diff --git a/common/src/main/java/dev/isxander/yacl3/gui/controllers/ListEntryWidget.java b/common/src/main/java/dev/isxander/yacl3/gui/controllers/ListEntryWidget.java index 15deff2..7e71cc7 100644 --- a/common/src/main/java/dev/isxander/yacl3/gui/controllers/ListEntryWidget.java +++ b/common/src/main/java/dev/isxander/yacl3/gui/controllers/ListEntryWidget.java @@ -80,7 +80,7 @@ public class ListEntryWidget extends AbstractWidget implements ContainerEventHan } protected void updateButtonStates() { - removeButton.active = listOption.available(); + removeButton.active = listOption.available() && listOption.numberOfEntries() > listOption.minimumNumberOfEntries(); moveUpButton.active = listOption.indexOf(listOptionEntry) > 0 && listOption.available(); moveDownButton.active = listOption.indexOf(listOptionEntry) < listOption.options().size() - 1 && listOption.available(); } |