diff options
author | isXander <xander@isxander.dev> | 2024-03-01 20:35:13 +0000 |
---|---|---|
committer | isXander <xander@isxander.dev> | 2024-03-01 20:35:13 +0000 |
commit | e0fac3798200c9c718281c2b9bb6cc5da04a47d1 (patch) | |
tree | e0ab2071722300b1a5fa916dcaf5a4c30870bf96 /common/src/main/java/dev/isxander | |
parent | 308d882fc015fd448deb059b2a814246f7a32f05 (diff) | |
parent | 9dce73ba8c10960e6502825b14c91e6ec56393a4 (diff) | |
download | YetAnotherConfigLib-e0fac3798200c9c718281c2b9bb6cc5da04a47d1.tar.gz YetAnotherConfigLib-e0fac3798200c9c718281c2b9bb6cc5da04a47d1.tar.bz2 YetAnotherConfigLib-e0fac3798200c9c718281c2b9bb6cc5da04a47d1.zip |
Merge branch '1.20.x/dev' into update/1.20.5
# Conflicts:
# common/src/main/java/dev/isxander/yacl3/gui/ElementListWidgetExt.java
Diffstat (limited to 'common/src/main/java/dev/isxander')
-rw-r--r-- | common/src/main/java/dev/isxander/yacl3/gui/ElementListWidgetExt.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/common/src/main/java/dev/isxander/yacl3/gui/ElementListWidgetExt.java b/common/src/main/java/dev/isxander/yacl3/gui/ElementListWidgetExt.java index 56dcfcc..a9a978f 100644 --- a/common/src/main/java/dev/isxander/yacl3/gui/ElementListWidgetExt.java +++ b/common/src/main/java/dev/isxander/yacl3/gui/ElementListWidgetExt.java @@ -123,6 +123,20 @@ public class ElementListWidgetExt<E extends ElementListWidgetExt.Entry<E>> exten } @Override + protected void ensureVisible(E entry) { + int i = this.getRowTop(this.children().indexOf(entry)); + int j = i - this.getY() - 4 - entry.getItemHeight(); + if (j < 0) { + this.setScrollAmount(this.getScrollAmount() + j); + } + + int k = this.getBottom() - i - entry.getItemHeight() * 2; + if (k < 0) { + this.setScrollAmount(this.getScrollAmount() - k); + } + } + + @Override protected void renderListItems(GuiGraphics graphics, int mouseX, int mouseY, float delta) { int left = this.getRowLeft(); int right = this.getRowWidth(); |