aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorisXander <xandersmith2008@gmail.com>2022-10-19 20:59:33 +0100
committerisXander <xandersmith2008@gmail.com>2022-10-19 20:59:33 +0100
commitc9e278f8945ff0cd9d144b4f481d9fecae0563b9 (patch)
tree4a0b66466117305e613f41e2d1c4cdc29fa5e2c1 /src/main
parent732eb451abf40c8b8286627520868687ec7306ff (diff)
downloadYetAnotherConfigLib-c9e278f8945ff0cd9d144b4f481d9fecae0563b9.tar.gz
YetAnotherConfigLib-c9e278f8945ff0cd9d144b4f481d9fecae0563b9.tar.bz2
YetAnotherConfigLib-c9e278f8945ff0cd9d144b4f481d9fecae0563b9.zip
fix label styles appearing at first position before they are rendered
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/dev/isxander/yacl/gui/OptionListWidget.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main/java/dev/isxander/yacl/gui/OptionListWidget.java b/src/main/java/dev/isxander/yacl/gui/OptionListWidget.java
index 6dba77e..ddbb06e 100644
--- a/src/main/java/dev/isxander/yacl/gui/OptionListWidget.java
+++ b/src/main/java/dev/isxander/yacl/gui/OptionListWidget.java
@@ -216,6 +216,14 @@ public class OptionListWidget extends ElementListWidget<OptionListWidget.Entry>
public void recacheViewableChildren() {
this.viewableChildren = ImmutableList.copyOf(super.children().stream().filter(Entry::isViewable).toList());
+
+ // update y positions before they need to be rendered are rendered
+ int i = 0;
+ for (Entry entry : viewableChildren) {
+ if (entry instanceof OptionEntry optionEntry)
+ optionEntry.widget.setDimension(optionEntry.widget.getDimension().setY(getRowTop(i)));
+ i++;
+ }
}
@Override