From 7c0faf2143da48008d815ecb7016e8d7bc4e412d Mon Sep 17 00:00:00 2001 From: neveler <55753029+neveler@users.noreply.github.com> Date: Thu, 1 Jan 2026 21:40:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=90=AF=E5=8A=A8=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E5=88=86=E9=9A=94=E7=AC=A6=E9=A2=9C=E8=89=B2=20(#5087?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/jackhuang/hmcl/ui/main/MainPage.java | 33 +++--------------- HMCL/src/main/resources/assets/css/root.css | 34 +++++++++++++++---- 2 files changed, 33 insertions(+), 34 deletions(-) diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/MainPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/MainPage.java index 5ad97c0bf..00aedc61b 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/MainPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/MainPage.java @@ -39,7 +39,6 @@ import javafx.scene.layout.BorderPane; import javafx.scene.layout.HBox; import javafx.scene.layout.StackPane; import javafx.scene.layout.VBox; -import javafx.scene.shape.Rectangle; import javafx.scene.text.TextFlow; import javafx.util.Duration; import org.jackhuang.hmcl.Metadata; @@ -207,10 +206,8 @@ public final class MainPage extends StackPane implements DecoratorPage { updatePane.getChildren().setAll(hBox, closeUpdateButton); } - StackPane launchPane = new StackPane(); + HBox launchPane = new HBox(); launchPane.getStyleClass().add("launch-pane"); - launchPane.setMaxWidth(230); - launchPane.setMaxHeight(55); FXUtils.onScroll(launchPane, versions, list -> { String currentId = getCurrentGame(); return Lang.indexWhere(list, instance -> instance.getId().equals(currentId)); @@ -219,16 +216,11 @@ public final class MainPage extends StackPane implements DecoratorPage { StackPane.setAlignment(launchPane, Pos.BOTTOM_RIGHT); { JFXButton launchButton = new JFXButton(); - launchButton.setPrefWidth(230); - launchButton.setPrefHeight(55); - //launchButton.setButtonType(JFXButton.ButtonType.RAISED); + launchButton.getStyleClass().add("launch-button"); launchButton.setDefaultButton(true); - launchButton.setClip(new Rectangle(-100, -100, 310, 200)); { VBox graphic = new VBox(); graphic.setAlignment(Pos.CENTER); - graphic.setTranslateX(-7); - graphic.setMaxWidth(200); Label launchLabel = new Label(); launchLabel.setStyle("-fx-font-size: 16px;"); Label currentLabel = new Label(); @@ -261,26 +253,11 @@ public final class MainPage extends StackPane implements DecoratorPage { launchButton.setGraphic(graphic); } - Rectangle separator = new Rectangle(); - separator.setWidth(1); - separator.setHeight(57); - separator.setTranslateX(95); - separator.setMouseTransparent(true); - menuButton = new JFXButton(); - menuButton.setPrefHeight(55); - menuButton.setPrefWidth(230); - //menuButton.setButtonType(JFXButton.ButtonType.RAISED); - menuButton.setStyle("-fx-font-size: 15px;"); + menuButton.getStyleClass().add("menu-button"); menuButton.setOnAction(e -> onMenu()); - menuButton.setClip(new Rectangle(211, -100, 100, 200)); - StackPane graphic = new StackPane(); - Node svg = SVG.ARROW_DROP_UP.createIcon(30); - StackPane.setAlignment(svg, Pos.CENTER_RIGHT); - graphic.getChildren().setAll(svg); - graphic.setTranslateX(6); FXUtils.installFastTooltip(menuButton, i18n("version.switch")); - menuButton.setGraphic(graphic); + menuButton.setGraphic(SVG.ARROW_DROP_UP.createIcon(30)); EventHandler secondaryClickHandle = event -> { if (event.getButton() == MouseButton.SECONDARY && event.getClickCount() == 1) { @@ -291,7 +268,7 @@ public final class MainPage extends StackPane implements DecoratorPage { launchButton.addEventHandler(MouseEvent.MOUSE_CLICKED, secondaryClickHandle); menuButton.addEventHandler(MouseEvent.MOUSE_CLICKED, secondaryClickHandle); - launchPane.getChildren().setAll(launchButton, separator, menuButton); + launchPane.getChildren().setAll(launchButton, menuButton); } getChildren().addAll(updatePane, launchPane); diff --git a/HMCL/src/main/resources/assets/css/root.css b/HMCL/src/main/resources/assets/css/root.css index ce4af8fbc..66e84eed4 100644 --- a/HMCL/src/main/resources/assets/css/root.css +++ b/HMCL/src/main/resources/assets/css/root.css @@ -421,18 +421,44 @@ * * ******************************************************************************/ +.launch-pane { + -fx-max-height: 57px; + -fx-min-height: 57px; + -fx-max-width: 230px; + -fx-min-width: 230px; +} + .launch-pane > .jfx-button { + -fx-translate-y: 1px; + -fx-max-height: 55px; + -fx-min-height: 55px; -fx-background-color: -monet-primary-container; -fx-cursor: hand; } +.launch-pane > .jfx-button.launch-button { + -fx-max-width: 207px; + -fx-min-width: 207px; + -fx-border-width: 0 3px 0 0; + -fx-border-color: -monet-on-surface-variant; + -fx-background-radius: 4px 0 0 4px; +} + +.launch-pane > .jfx-button.menu-button { + -fx-max-width: 20px; + -fx-min-width: 20px; + -fx-font-size: 15px; + -fx-background-radius: 0 4px 4px 0; +} + .launch-pane > .jfx-button > StackPane > .jfx-rippler { -jfx-rippler-fill: -monet-on-primary-container; -jfx-mask-type: CIRCLE; - -fx-padding: 0.0; + -fx-padding: 0; } -.launch-pane > .jfx-button, .jfx-button * { +.launch-pane > .jfx-button, +.launch-pane > .jfx-button * { -fx-text-fill: -monet-on-primary-container; -fx-font-size: 14px; } @@ -441,10 +467,6 @@ -fx-fill: -monet-on-primary-container; } -.launch-pane > Rectangle { - -fx-fill: -monet-primary-container; -} - /******************************************************************************* * * * JFX Tab Pane *