aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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();