diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/GameListPopupMenu.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/GameListPopupMenu.java index 703ef2f97a..767808887b 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/GameListPopupMenu.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/GameListPopupMenu.java @@ -31,7 +31,6 @@ import javafx.scene.control.ListCell; import javafx.scene.control.ListView; import javafx.scene.layout.BorderPane; -import javafx.scene.layout.HBox; import javafx.scene.layout.Region; import javafx.scene.layout.StackPane; import org.jackhuang.hmcl.game.Version; @@ -66,10 +65,11 @@ public GameListPopupMenu() { this.getStyleClass().add("popup-menu-content"); listView.setCellFactory(Cell::new); - listView.setFixedCellSize(60); + + listView.setFixedCellSize(50); listView.setPrefWidth(300); - listView.prefHeightProperty().bind(Bindings.size(getItems()).multiply(60).add(2)); + listView.prefHeightProperty().bind(Bindings.size(getItems()).multiply(50).add(2)); Label placeholder = new Label(i18n("version.empty")); placeholder.setStyle("-fx-padding: 10px; -fx-text-fill: -monet-on-surface-variant; -fx-font-style: italic;"); @@ -94,35 +94,34 @@ private static final class Cell extends ListCell { public Cell(ListView listView) { this.setPadding(Insets.EMPTY); - HBox root = new HBox(); - - root.setSpacing(8); - root.setAlignment(Pos.CENTER_LEFT); - - StackPane imageViewContainer = new StackPane(); - FXUtils.setLimitWidth(imageViewContainer, 32); - FXUtils.setLimitHeight(imageViewContainer, 32); this.imageView = new ImageContainer(32); - imageViewContainer.getChildren().setAll(imageView); + this.imageView.setMouseTransparent(true); + BorderPane.setAlignment(imageView, Pos.CENTER); this.content = new TwoLineListItem(); + this.content.setMouseTransparent(true); FXUtils.onChangeAndOperate(tag, tag -> { content.getTags().clear(); if (StringUtils.isNotBlank(tag)) { content.addTag(tag); } }); - BorderPane.setAlignment(content, Pos.CENTER); - root.getChildren().setAll(imageView, content); - StackPane pane = new StackPane(); - pane.getChildren().setAll(root); - pane.getStyleClass().add("menu-container"); - root.setMouseTransparent(true); + BorderPane container = new BorderPane(); + container.getStyleClass().add("container"); + container.setPickOnBounds(false); + container.setLeft(imageView); + container.setCenter(content); - RipplerContainer ripplerContainer = new RipplerContainer(pane); - FXUtils.onClicked(ripplerContainer, () -> { + RipplerContainer ripplerContainer = new RipplerContainer(container); + + StackPane rootPane = new StackPane(); + rootPane.getStyleClass().add("advanced-list-item"); + rootPane.getChildren().setAll(ripplerContainer); + rootPane.maxWidthProperty().bind(listView.widthProperty().subtract(5)); + + FXUtils.onClicked(rootPane, () -> { GameItem item = getItem(); if (item != null) { item.getProfile().setSelectedVersion(item.getId()); @@ -130,8 +129,8 @@ public Cell(ListView listView) { popup.hide(); } }); - this.graphic = ripplerContainer; - ripplerContainer.maxWidthProperty().bind(listView.widthProperty().subtract(5)); + + this.graphic = rootPane; } @Override