From c70e2abed5bb63026aa391773caa8ae598546229 Mon Sep 17 00:00:00 2001 From: Basique Date: Sat, 7 Sep 2024 00:45:44 +0300 Subject: [PATCH] added support for configuring scaling --- .../limelight/impl/config/LimelightConfigModel.java | 7 +++++++ .../io/wispforest/limelight/impl/ui/LimelightScreen.java | 2 +- src/client/resources/assets/limelight/lang/en_us.json | 4 ++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/client/java/io/wispforest/limelight/impl/config/LimelightConfigModel.java b/src/client/java/io/wispforest/limelight/impl/config/LimelightConfigModel.java index b1c5500..5e45b1b 100644 --- a/src/client/java/io/wispforest/limelight/impl/config/LimelightConfigModel.java +++ b/src/client/java/io/wispforest/limelight/impl/config/LimelightConfigModel.java @@ -3,6 +3,7 @@ import blue.endless.jankson.Comment; import io.wispforest.owo.config.annotation.Config; import io.wispforest.owo.config.annotation.Hook; +import io.wispforest.owo.config.annotation.RangeConstraint; import io.wispforest.owo.config.annotation.SectionHeader; import net.minecraft.util.Identifier; @@ -20,6 +21,12 @@ public class LimelightConfigModel { @Comment("The theme used in the Limelight GUI") public Theme theme = Theme.LIGHT; + @Comment("Percent of screen width used by the Limelight popup") + @RangeConstraint(min = 0, max = 100) public int horizontalPercent = 40; + + @Comment("Percent of screen height used by the Limelight popup") + @RangeConstraint(min = 0, max = 100) public int verticalPercent = 50; + @Hook @SectionHeader("extensions") public Map enabledExtensions = new HashMap<>(); diff --git a/src/client/java/io/wispforest/limelight/impl/ui/LimelightScreen.java b/src/client/java/io/wispforest/limelight/impl/ui/LimelightScreen.java index 5739858..a904d10 100644 --- a/src/client/java/io/wispforest/limelight/impl/ui/LimelightScreen.java +++ b/src/client/java/io/wispforest/limelight/impl/ui/LimelightScreen.java @@ -34,7 +34,7 @@ public class LimelightScreen extends BaseOwoScreen { @Override protected void build(FlowLayout rootComponent) { - FlowLayout sizeLimitFlow = Containers.verticalFlow(Sizing.fill(40), Sizing.fill(50)); + FlowLayout sizeLimitFlow = Containers.verticalFlow(Sizing.fill(Limelight.CONFIG.horizontalPercent()), Sizing.fill(Limelight.CONFIG.verticalPercent())); rootComponent .child(sizeLimitFlow) diff --git a/src/client/resources/assets/limelight/lang/en_us.json b/src/client/resources/assets/limelight/lang/en_us.json index 4e1f3e1..21c0110 100644 --- a/src/client/resources/assets/limelight/lang/en_us.json +++ b/src/client/resources/assets/limelight/lang/en_us.json @@ -27,6 +27,10 @@ "text.config.limelight.option.implicitWikiSearch.tooltip": "Allows you to search wikis without specifying a bang", "text.config.limelight.option.theme": "Theme", "text.config.limelight.option.theme.tooltip": "The theme used in the Limelight GUI", + "text.config.limelight.option.horizontalPercent": "Horizontal Percent", + "text.config.limelight.option.horizontalPercent.tooltip": "Percent of screen width used by the Limelight popup", + "text.config.limelight.option.verticalPercent": "Vertical Percent", + "text.config.limelight.option.verticalPercent.tooltip": "Percent of screen height used by the Limelight popup", "text.config.limelight.enum.theme.light": "Light", "text.config.limelight.enum.theme.dark": "Dark",