From 38aebfc23ec50798c44d2e0790924e62f4c46f98 Mon Sep 17 00:00:00 2001 From: isXander Date: Mon, 19 Sep 2022 19:44:42 +0100 Subject: make tooltips max width just a little smaller & allow search query to match ActionController value text --- src/main/java/dev/isxander/yacl/gui/OptionListWidget.java | 6 ++---- src/main/java/dev/isxander/yacl/gui/TooltipButtonWidget.java | 2 +- .../java/dev/isxander/yacl/gui/controllers/ActionController.java | 5 +++++ .../java/dev/isxander/yacl/gui/controllers/ControllerWidget.java | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/dev/isxander/yacl/gui/OptionListWidget.java b/src/main/java/dev/isxander/yacl/gui/OptionListWidget.java index 08007c3..729e063 100644 --- a/src/main/java/dev/isxander/yacl/gui/OptionListWidget.java +++ b/src/main/java/dev/isxander/yacl/gui/OptionListWidget.java @@ -19,9 +19,7 @@ import net.minecraft.text.Text; import net.minecraft.util.math.MathHelper; import org.jetbrains.annotations.Nullable; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; +import java.util.*; import java.util.function.Supplier; public class OptionListWidget extends ElementListWidget { @@ -310,7 +308,7 @@ public class OptionListWidget extends ElementListWidget this.group = group; this.screen = screen; this.wrappedName = MultilineText.create(textRenderer, group.name(), getRowWidth() - 45); - this.wrappedTooltip = MultilineText.create(textRenderer, group.tooltip(), screen.width / 3 * 2); + this.wrappedTooltip = MultilineText.create(textRenderer, group.tooltip(), screen.width / 3 * 2 - 10); this.groupExpanded = !group.collapsed(); this.expandMinimizeButton = new LowProfileButtonWidget(0, 0, 20, 20, Text.empty(), btn -> { setExpanded(!isExpanded()); diff --git a/src/main/java/dev/isxander/yacl/gui/TooltipButtonWidget.java b/src/main/java/dev/isxander/yacl/gui/TooltipButtonWidget.java index e59c06c..d105f7b 100644 --- a/src/main/java/dev/isxander/yacl/gui/TooltipButtonWidget.java +++ b/src/main/java/dev/isxander/yacl/gui/TooltipButtonWidget.java @@ -25,6 +25,6 @@ public class TooltipButtonWidget extends ButtonWidget { } public void setTooltip(Text tooltip) { - wrappedDescription = MultilineText.create(MinecraftClient.getInstance().textRenderer, tooltip, screen.width / 3); + wrappedDescription = MultilineText.create(MinecraftClient.getInstance().textRenderer, tooltip, screen.width / 3 - 5); } } diff --git a/src/main/java/dev/isxander/yacl/gui/controllers/ActionController.java b/src/main/java/dev/isxander/yacl/gui/controllers/ActionController.java index 673b614..ee3f988 100644 --- a/src/main/java/dev/isxander/yacl/gui/controllers/ActionController.java +++ b/src/main/java/dev/isxander/yacl/gui/controllers/ActionController.java @@ -105,5 +105,10 @@ public class ActionController implements Controller> extends Abstract } private void updateTooltip() { - this.wrappedTooltip = MultilineText.create(textRenderer, control.option().tooltip(), screen.width / 3 * 2); + this.wrappedTooltip = MultilineText.create(textRenderer, control.option().tooltip(), screen.width / 3 * 2 - 10); } protected int getControlWidth() { -- cgit