diff --git a/src/main/java/fzmm/zailer/me/client/gui/EncryptBookScreen.java b/src/main/java/fzmm/zailer/me/client/gui/EncryptBookScreen.java index f016fbc1..c19448f9 100644 --- a/src/main/java/fzmm/zailer/me/client/gui/EncryptBookScreen.java +++ b/src/main/java/fzmm/zailer/me/client/gui/EncryptBookScreen.java @@ -59,7 +59,7 @@ protected void setupButtonsCallbacks(FlowLayout rootComponent) { this.authorField = TextBoxRow.setup(rootComponent, AUTHOR_ID, MinecraftClient.getInstance().player.getName().getString(), 512); this.titleField = TextBoxRow.setup(rootComponent, TITLE_ID, config.defaultBookTitle(), WrittenBookContentComponent.MAX_TITLE_LENGTH); this.maxMessageLengthField = SliderRow.setup(rootComponent, MAX_MESSAGE_LENGTH_ID, config.maxMessageLength(), - 1, 512, Integer.class, 0, 1, + 1, 512, Integer.class, 0, 16, aDouble -> this.messageField.setMaxLength(aDouble.intValue()) ); //bottom buttons diff --git a/src/main/java/fzmm/zailer/me/client/gui/components/row/SliderRow.java b/src/main/java/fzmm/zailer/me/client/gui/components/row/SliderRow.java index 3cd01c79..0c8af800 100644 --- a/src/main/java/fzmm/zailer/me/client/gui/components/row/SliderRow.java +++ b/src/main/java/fzmm/zailer/me/client/gui/components/row/SliderRow.java @@ -52,7 +52,7 @@ public static SliderWidget setup(FlowLayout rootComponent, String id, double def numberSlider.max(max); numberSlider.setFromDiscreteValue(defaultValue); numberSlider.updateMessage(); - numberSlider.scrollStep(scrollStep); + numberSlider.scrollStep(scrollStep / (max - min)); resetButton.onPress(button -> numberSlider.setFromDiscreteValue(defaultValue)); resetButton.active = false; diff --git a/src/main/java/fzmm/zailer/me/client/gui/imagetext/ImagetextScreen.java b/src/main/java/fzmm/zailer/me/client/gui/imagetext/ImagetextScreen.java index e38b89f3..acafa928 100644 --- a/src/main/java/fzmm/zailer/me/client/gui/imagetext/ImagetextScreen.java +++ b/src/main/java/fzmm/zailer/me/client/gui/imagetext/ImagetextScreen.java @@ -26,6 +26,7 @@ import io.wispforest.owo.ui.container.FlowLayout; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; +import net.minecraft.text.Text; import net.minecraft.util.Pair; import org.jetbrains.annotations.Nullable; @@ -77,15 +78,16 @@ protected void setupButtonsCallbacks(FlowLayout rootComponent) { SliderWidget widthSlider = rootComponent.childById(SliderWidget.class, SliderRow.getSliderId(WIDTH_ID)); SliderWidget heightSlider = rootComponent.childById(SliderWidget.class, SliderRow.getSliderId(HEIGHT_ID)); ButtonWidget.PressAction onWidthChange = button -> this.onResolutionChanged(imageButton, this.preserveImageAspectRatioToggle, widthSlider, heightSlider, true); - this.widthSlider = SliderRow.setup(rootComponent, WIDTH_ID, DEFAULT_SIZE_VALUE, 2, config.maxResolution(), Integer.class, 0, 1, + this.widthSlider = SliderRow.setup(rootComponent, WIDTH_ID, DEFAULT_SIZE_VALUE, 2, config.maxResolution(), Integer.class, 0, 3, aDouble -> onWidthChange.onPress(null) ); - this.heightSlider = SliderRow.setup(rootComponent, HEIGHT_ID, DEFAULT_SIZE_VALUE, 2, config.maxResolution(), Integer.class, 0, 1, + this.heightSlider = SliderRow.setup(rootComponent, HEIGHT_ID, DEFAULT_SIZE_VALUE, 2, config.maxResolution(), Integer.class, 0, 3, aDouble -> this.onResolutionChanged(imageButton, this.preserveImageAspectRatioToggle, heightSlider, widthSlider, false) ); this.showResolutionToggle = BooleanRow.setup(rootComponent, SHOW_RESOLUTION_ID, false); this.smoothImageToggle = BooleanRow.setup(rootComponent, SMOOTH_IMAGE_ID, true); - this.percentageOfSimilarityToCompress = SliderRow.setup(rootComponent, PERCENTAGE_OF_SIMILARITY_TO_COMPRESS_ID, config.defaultPercentageOfSimilarityToCompress(), 0d, MAX_PERCENTAGE_OF_SIMILARITY_TO_COMPRESS, Double.class, 1, 0.05d, null); + this.percentageOfSimilarityToCompress = SliderRow.setup(rootComponent, PERCENTAGE_OF_SIMILARITY_TO_COMPRESS_ID, config.defaultPercentageOfSimilarityToCompress(), 0d, MAX_PERCENTAGE_OF_SIMILARITY_TO_COMPRESS, Double.class, 1, 0.1d, null); + this.percentageOfSimilarityToCompress.message(s -> Text.literal(s + "%")); //tabs this.setTabs(rootComponent, selectedTab, ImagetextTabs.values(), "tabs", anEnum -> selectedTab = (ImagetextTabs) anEnum, this.tabs); this.setTabs(rootComponent, selectedAlgorithm, ImagetextAlgorithms.values(), "algorithms", anEnum -> selectedAlgorithm = (ImagetextAlgorithms) anEnum, this.algorithmsTabs); diff --git a/src/main/java/fzmm/zailer/me/client/gui/imagetext/algorithms/ImagetextBrailleAlgorithm.java b/src/main/java/fzmm/zailer/me/client/gui/imagetext/algorithms/ImagetextBrailleAlgorithm.java index d9e1c3b7..ebaaf8af 100644 --- a/src/main/java/fzmm/zailer/me/client/gui/imagetext/algorithms/ImagetextBrailleAlgorithm.java +++ b/src/main/java/fzmm/zailer/me/client/gui/imagetext/algorithms/ImagetextBrailleAlgorithm.java @@ -53,7 +53,7 @@ public List get(ImagetextLogic logic, ImagetextData data, int lineS @Override public void setupComponents(FlowLayout rootComponent) { - this.edgeThresholdSlider = SliderRow.setup(rootComponent, EDGE_THRESHOLD_ID, 30, 1, 255, Integer.class, 0, 1, null); + this.edgeThresholdSlider = SliderRow.setup(rootComponent, EDGE_THRESHOLD_ID, 30, 1, 255, Integer.class, 0, 5, null); this.edgeDistanceSlider = SliderRow.setup(rootComponent, EDGE_DISTANCE_ID, 2, 1, 5, Integer.class, 0, 1, null); this.invertBooleanButton = BooleanRow.setup(rootComponent, INVERT_ID, false, null); } diff --git a/src/main/java/fzmm/zailer/me/client/gui/imagetext/tabs/ImagetextTextDisplayTab.java b/src/main/java/fzmm/zailer/me/client/gui/imagetext/tabs/ImagetextTextDisplayTab.java index 75c85aab..7f5a6430 100644 --- a/src/main/java/fzmm/zailer/me/client/gui/imagetext/tabs/ImagetextTextDisplayTab.java +++ b/src/main/java/fzmm/zailer/me/client/gui/imagetext/tabs/ImagetextTextDisplayTab.java @@ -94,13 +94,13 @@ public void execute(ImagetextLogic logic) { public void setupComponents(FlowLayout rootComponent) { assert MinecraftClient.getInstance().player != null; - this.textOpacity = SliderRow.setup(rootComponent, TEXT_OPACITY_ID, 255, 0, 255, Integer.class, 0, 1, null); + this.textOpacity = SliderRow.setup(rootComponent, TEXT_OPACITY_ID, 255, 0, 255, Integer.class, 0, 10, null); this.backgroundColor = ColorRow.setup(rootComponent, BACKGROUND_COLOR_ID, Color.ofArgb(DisplayEntity.TextDisplayEntity.INITIAL_BACKGROUND), true, 0, null); this.textShadow = BooleanRow.setup(rootComponent, TEXT_SHADOW_ID, false, null); this.textSeeThrough = BooleanRow.setup(rootComponent, TEXT_SEE_THROUGH_ID, false, null); this.textAlignment = EnumRow.setup(rootComponent, TEXT_ALIGNMENT_ID, TextDisplayAlignmentOption.LEFT, null); this.billboard = EnumRow.setup(rootComponent, BILLBOARD_ID, DisplayEntityBillboardOption.FIXED, null); - this.rotation = SliderRow.setup(rootComponent, ROTATION_ID, MathHelper.wrapDegrees(MinecraftClient.getInstance().player.getYaw()), -180, 180, Float.class, 1, 0.25d, null); + this.rotation = SliderRow.setup(rootComponent, ROTATION_ID, MathHelper.wrapDegrees(MinecraftClient.getInstance().player.getYaw()), -180, 180, Float.class, 1, 30, null); } @Override diff --git a/src/main/java/fzmm/zailer/me/client/gui/text_format/tabs/TextFormatRainbowTab.java b/src/main/java/fzmm/zailer/me/client/gui/text_format/tabs/TextFormatRainbowTab.java index 53a76c73..bc98bd24 100644 --- a/src/main/java/fzmm/zailer/me/client/gui/text_format/tabs/TextFormatRainbowTab.java +++ b/src/main/java/fzmm/zailer/me/client/gui/text_format/tabs/TextFormatRainbowTab.java @@ -44,10 +44,10 @@ public Text getText(TextFormatLogic logic) { @Override public void setupComponents(FlowLayout rootComponent) { FzmmConfig.TextFormat config = FzmmClient.CONFIG.textFormat; - this.hue = SliderRow.setup(rootComponent, HUE_ID, 1d, 0d, 1d, Float.class, 3, 0.001d, d -> this.callback.accept("")); - this.brightness = SliderRow.setup(rootComponent, BRIGHTNESS_ID, 0.8d, 0d, 1d, Float.class, 3, 0.001d, d -> this.callback.accept("")); - this.saturation = SliderRow.setup(rootComponent, SATURATION_ID, 1d, 0d, 1d, Float.class, 3, 0.001d, d -> this.callback.accept("")); - this.hueStep = SliderRow.setup(rootComponent, HUE_STEP_ID, 0.05d, config.minRainbowHueStep(), config.maxRainbowHueStep(), Float.class, 3, 0.001d, d -> this.callback.accept("")); + this.hue = SliderRow.setup(rootComponent, HUE_ID, 1d, 0d, 1d, Float.class, 3, 0.025d, d -> this.callback.accept("")); + this.brightness = SliderRow.setup(rootComponent, BRIGHTNESS_ID, 0.8d, 0d, 1d, Float.class, 3, 0.025d, d -> this.callback.accept("")); + this.saturation = SliderRow.setup(rootComponent, SATURATION_ID, 1d, 0d, 1d, Float.class, 3, 0.025d, d -> this.callback.accept("")); + this.hueStep = SliderRow.setup(rootComponent, HUE_STEP_ID, 0.05d, config.minRainbowHueStep(), config.maxRainbowHueStep(), Float.class, 3, 0.005d, d -> this.callback.accept("")); } @Override