aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorisXander <xander@isxander.dev>2024-02-29 22:24:57 +0000
committerisXander <xander@isxander.dev>2024-02-29 22:24:57 +0000
commit9dce73ba8c10960e6502825b14c91e6ec56393a4 (patch)
treef53a26ea3c6efcea5ee7dd466ad2373ad6123dee
parent0a10f11494db07f974b416c1f69184728b68374c (diff)
downloadYetAnotherConfigLib-9dce73ba8c10960e6502825b14c91e6ec56393a4.tar.gz
YetAnotherConfigLib-9dce73ba8c10960e6502825b14c91e6ec56393a4.tar.bz2
YetAnotherConfigLib-9dce73ba8c10960e6502825b14c91e6ec56393a4.zip
Fix keyboard/controller navigation not properly scrolling when overflowing
-rw-r--r--build.gradle.kts2
-rw-r--r--changelogs/3.3.3+1.20.4.md3
-rw-r--r--common/src/main/java/dev/isxander/yacl3/gui/ElementListWidgetExt.java14
3 files changed, 18 insertions, 1 deletions
diff --git a/build.gradle.kts b/build.gradle.kts
index d1c7c3e..b879642 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -12,7 +12,7 @@ architectury {
minecraft = libs.versions.minecraft.get()
}
-version = "3.3.2+1.20.4"
+version = "3.3.3+1.20.4"
val isBeta = "beta" in version.toString()
val changelogText = rootProject.file("changelogs/${project.version}.md").takeIf { it.exists() }?.readText() ?: "No changelog provided."
diff --git a/changelogs/3.3.3+1.20.4.md b/changelogs/3.3.3+1.20.4.md
new file mode 100644
index 0000000..9c863fc
--- /dev/null
+++ b/changelogs/3.3.3+1.20.4.md
@@ -0,0 +1,3 @@
+# YetAnotherConfigLib v3.3.3 for 1.20.4
+
+- Fix keyboard/controller navigation not properly scrolling when overflowing
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 91cda1f..3ae9bdb 100644
--- a/common/src/main/java/dev/isxander/yacl3/gui/ElementListWidgetExt.java
+++ b/common/src/main/java/dev/isxander/yacl3/gui/ElementListWidgetExt.java
@@ -124,6 +124,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 renderList(GuiGraphics graphics, int mouseX, int mouseY, float delta) {
int left = this.getRowLeft();
int right = this.getRowWidth();