aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorisXander <xander@isxander.dev>2023-05-27 21:32:12 +0100
committerisXander <xander@isxander.dev>2023-05-27 21:32:12 +0100
commitd014d66e3aeda3399b86294119c13501cab5b8c1 (patch)
tree8183931e3bc45cf1cb9cc69f6a9e2d71760c5ddb /common
parent8829b00d238ff42fba6e1ad3eee3f570c84e08b6 (diff)
downloadYetAnotherConfigLib-d014d66e3aeda3399b86294119c13501cab5b8c1.tar.gz
YetAnotherConfigLib-d014d66e3aeda3399b86294119c13501cab5b8c1.tar.bz2
YetAnotherConfigLib-d014d66e3aeda3399b86294119c13501cab5b8c1.zip
fix last clicked option forcing its description
Diffstat (limited to 'common')
-rw-r--r--common/src/main/java/dev/isxander/yacl/gui/OptionListWidget.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/common/src/main/java/dev/isxander/yacl/gui/OptionListWidget.java b/common/src/main/java/dev/isxander/yacl/gui/OptionListWidget.java
index ca903ef..1c3596a 100644
--- a/common/src/main/java/dev/isxander/yacl/gui/OptionListWidget.java
+++ b/common/src/main/java/dev/isxander/yacl/gui/OptionListWidget.java
@@ -299,7 +299,7 @@ public class OptionListWidget extends ElementListWidgetExt<OptionListWidget.Entr
resetButton.render(graphics, mouseX, mouseY, tickDelta);
}
- if (isHovered() || isFocused()) {
+ if (isHovered()) {
setHoverDescription(DescriptionWithName.of(option.name(), option.description()));
}
}
@@ -335,6 +335,8 @@ public class OptionListWidget extends ElementListWidgetExt<OptionListWidget.Entr
@Override
public void setFocused(boolean focused) {
super.setFocused(focused);
+ if (focused)
+ setHoverDescription(DescriptionWithName.of(option.name(), option.description()));
}
@Override
@@ -392,7 +394,7 @@ public class OptionListWidget extends ElementListWidgetExt<OptionListWidget.Entr
wrappedName.renderCentered(graphics, x + entryWidth / 2, y + getYPadding());
- if (isHovered() || isFocused()) {
+ if (isHovered()) {
setHoverDescription(DescriptionWithName.of(group.name(), group.description()));
}
}
@@ -438,6 +440,13 @@ public class OptionListWidget extends ElementListWidgetExt<OptionListWidget.Entr
}
@Override
+ public void setFocused(boolean focused) {
+ super.setFocused(focused);
+ if (focused)
+ setHoverDescription(DescriptionWithName.of(group.name(), group.description()));
+ }
+
+ @Override
public List<? extends NarratableEntry> narratables() {
return ImmutableList.of(new NarratableEntry() {
@Override