From f1c8791961681fc02dd045e776a1afaff7e81ca2 Mon Sep 17 00:00:00 2001 From: Wulian233 <1055917385@qq.com> Date: Mon, 6 Oct 2025 16:20:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=A8=A1=E7=BB=84=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E5=AF=B9=E8=AF=9D=E6=A1=86=20UI=20=E5=AE=BD=E9=AB=98?= =?UTF-8?q?=20(#4616)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/jackhuang/hmcl/ui/versions/ModListPageSkin.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/ModListPageSkin.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/ModListPageSkin.java index 3bf95b4c2..d0170a090 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/ModListPageSkin.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/ModListPageSkin.java @@ -37,6 +37,7 @@ import javafx.scene.input.KeyEvent; import javafx.scene.layout.HBox; import javafx.scene.layout.Priority; import javafx.scene.layout.StackPane; +import javafx.stage.Stage; import javafx.util.Duration; import org.jackhuang.hmcl.mod.LocalModFile; import org.jackhuang.hmcl.mod.ModLoaderType; @@ -418,6 +419,9 @@ final class ModListPageSkin extends SkinBase { HBox titleContainer = new HBox(); titleContainer.setSpacing(8); + Stage stage = Controllers.getStage(); + maxWidthProperty().bind(stage.widthProperty().multiply(0.7)); + ImageView imageView = new ImageView(); FXUtils.limitSize(imageView, 40, 40); loadModIcon(modInfo.getModInfo(), 40) @@ -456,6 +460,11 @@ final class ModListPageSkin extends SkinBase { descriptionPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); descriptionPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED); descriptionPane.setFitToWidth(true); + description.heightProperty().addListener((obs, oldVal, newVal) -> { + double maxHeight = stage.getHeight() * 0.5; + double targetHeight = Math.min(newVal.doubleValue(), maxHeight); + descriptionPane.setPrefViewportHeight(targetHeight); + }); setBody(descriptionPane);