diff --git a/src/main/java/org/teacon/slides/screen/SlideItemScreen.java b/src/main/java/org/teacon/slides/screen/SlideItemScreen.java index 866907f..4511cee 100644 --- a/src/main/java/org/teacon/slides/screen/SlideItemScreen.java +++ b/src/main/java/org/teacon/slides/screen/SlideItemScreen.java @@ -1,6 +1,7 @@ package org.teacon.slides.screen; import com.mojang.blaze3d.systems.RenderSystem; +import net.minecraft.ChatFormatting; import net.minecraft.FieldsAreNonnullByDefault; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.client.gui.GuiGraphics; @@ -37,7 +38,29 @@ public final class SlideItemScreen extends AbstractContainerScreen% auto").withStyle(ChatFormatting.AQUA), + Component.literal("%").withStyle(ChatFormatting.AQUA)) + .withStyle(ChatFormatting.GRAY), + SIZE_HINT_4 = Component.translatable("gui.slide_show.size_hint.height_auto") + .withStyle(ChatFormatting.GRAY), + SIZE_HINT_5 = Component.translatable("gui.slide_show.size_hint.one", + Component.literal("auto %").withStyle(ChatFormatting.AQUA)) + .withStyle(ChatFormatting.GRAY), + SIZE_HINT_6 = Component.translatable("gui.slide_show.size_hint.width_auto") + .withStyle(ChatFormatting.GRAY), + SIZE_HINT_7 = Component.translatable("gui.slide_show.size_hint.one", + Component.literal("% %").withStyle(ChatFormatting.AQUA)) + .withStyle(ChatFormatting.GRAY), + SIZE_HINT_8 = Component.translatable("gui.slide_show.size_hint.both") + .withStyle(ChatFormatting.GRAY); private static final int URL_MAX_LENGTH = 1 << 9, @@ -180,7 +203,11 @@ protected void renderTooltip(GuiGraphics gui, int mouseX, int mouseY) { if (offsetX >= 7 && offsetY >= 35 && offsetX < 25 && offsetY < 54) { gui.renderComponentTooltip(font, this.getUrlTexts(), mouseX, mouseY); } else if (offsetX >= 7 && offsetY >= 57 && offsetX < 25 && offsetY < 76) { - gui.renderTooltip(font, SIZE_TEXT, mouseX, mouseY); + gui.renderComponentTooltip(font, List.of(SIZE_TEXT, + Component.literal(""), SIZE_HINT_1, SIZE_HINT_2, + Component.literal(""), SIZE_HINT_3, SIZE_HINT_4, + Component.literal(""), SIZE_HINT_5, SIZE_HINT_6, + Component.literal(""), SIZE_HINT_7, SIZE_HINT_8), mouseX, mouseY); } } diff --git a/src/main/resources/assets/slide_show/lang/en_us.json b/src/main/resources/assets/slide_show/lang/en_us.json index 50342bf..66d791f 100644 --- a/src/main/resources/assets/slide_show/lang/en_us.json +++ b/src/main/resources/assets/slide_show/lang/en_us.json @@ -38,6 +38,13 @@ "gui.slide_show.rotate": "Rotate Clockwise", "gui.slide_show.single_double_sided": "Switch Single-Sided / Double-Sided", + "gui.slide_show.size_hint.one": "%s", + "gui.slide_show.size_hint.two": "%s or %s", + "gui.slide_show.size_hint.contain_or_cover": "While preserving its aspect ratio, the image is rendered at the largest size contained within, or covering, the projection area defined by the projector", + "gui.slide_show.size_hint.height_auto": "The width will be stretched to the specified percentage while the height is computed using the image's corresponding aspect ratio", + "gui.slide_show.size_hint.width_auto": "The height will be stretched to the specified percentage while the width is computed using the image's corresponding aspect ratio", + "gui.slide_show.size_hint.both": "The width and the height will be stretched to the specified percentage of the projection area defined by the projector", + "gui.slide_show.log_comment": "at %s by %s", "gui.slide_show.log_comment_nobody": "at %s", "gui.slide_show.log_message.slide_show.create_url": "The image was created in the server", diff --git a/src/main/resources/assets/slide_show/lang/zh_cn.json b/src/main/resources/assets/slide_show/lang/zh_cn.json index 12d951b..4d9be31 100644 --- a/src/main/resources/assets/slide_show/lang/zh_cn.json +++ b/src/main/resources/assets/slide_show/lang/zh_cn.json @@ -38,6 +38,13 @@ "gui.slide_show.rotate": "顺时针旋转", "gui.slide_show.single_double_sided": "切换单面/双面", + "gui.slide_show.size_hint.one": "%s", + "gui.slide_show.size_hint.two": "%s 或 %s", + "gui.slide_show.size_hint.contain_or_cover": "缩放图片以完全覆盖(cover)或最大包含(contain)投影仪定义的投影区域", + "gui.slide_show.size_hint.height_auto": "宽度使用指定百分比,未指定的高度依图片固有长宽比例计算", + "gui.slide_show.size_hint.width_auto": "高度使用指定百分比,未指定的宽度依图片固有长宽比例计算", + "gui.slide_show.size_hint.both": "宽度和高度将拉伸至投影仪定义的投影区域的指定百分比", + "gui.slide_show.log_comment": "%s(操作者:%s)", "gui.slide_show.log_comment_nobody": "%s", "gui.slide_show.log_message.slide_show.create_url": "该图片在服务器的创建时间:",