Skip to content

Commit

Permalink
Refine DownloadPage
Browse files Browse the repository at this point in the history
* Fix cursor is not hand when hovering on ModItem
* Fix clicking on the ModItem in ModVersion dialog would open a new dialog again
* Fix ESC doesn't work in ModVersion dialog
  • Loading branch information
yushijinhun committed Dec 31, 2024
1 parent 78e15d1 commit 6f53da1
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;

import static org.jackhuang.hmcl.ui.FXUtils.onEscPressed;
import static org.jackhuang.hmcl.util.i18n.I18n.i18n;

public class DownloadPage extends Control implements DecoratorPage {
Expand Down Expand Up @@ -380,6 +381,7 @@ private static final class ModItem extends StackPane {
HBox descPane = new HBox(8);
descPane.setPadding(new Insets(0, 8, 0, 8));
descPane.setAlignment(Pos.CENTER_LEFT);
descPane.setMouseTransparent(true);

{
StackPane graphicPane = new StackPane();
Expand Down Expand Up @@ -445,7 +447,7 @@ public ModVersion(RemoteMod.Version version, DownloadPage selfPage) {
VBox box = new VBox(8);
box.setPadding(new Insets(8));
ModItem modItem = new ModItem(version, selfPage);
FXUtils.onClicked(modItem, () -> fireEvent(new DialogCloseEvent()));
modItem.setMouseTransparent(true); // Item is displayed for info, clicking shouldn't open the dialog again
box.getChildren().setAll(modItem);
SpinnerPane spinnerPane = new SpinnerPane();
ScrollPane scrollPane = new ScrollPane();
Expand Down Expand Up @@ -488,6 +490,8 @@ public ModVersion(RemoteMod.Version version, DownloadPage selfPage) {

this.prefWidthProperty().bind(BindingMapping.of(Controllers.getStage().widthProperty()).map(w -> w.doubleValue() * 0.7));
this.prefHeightProperty().bind(BindingMapping.of(Controllers.getStage().heightProperty()).map(w -> w.doubleValue() * 0.7));

onEscPressed(this, cancelButton::fire);
}

private void loadDependencies(RemoteMod.Version version, DownloadPage selfPage, SpinnerPane spinnerPane, ComponentList dependenciesList) {
Expand Down

0 comments on commit 6f53da1

Please sign in to comment.