Fix always showing horizontal scrollbar of game list popup in main page

This commit is contained in:
huanghongxun 2018-09-30 20:07:07 +08:00
parent b1b3eb9369
commit 2de2f45124
3 changed files with 19 additions and 6 deletions

View File

@ -32,6 +32,7 @@ import javafx.fxml.FXML;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.control.Label;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.scene.shape.Rectangle;
@ -90,7 +91,8 @@ public final class MainPage extends StackPane implements DecoratorPage {
btnLaunch.setClip(new Rectangle(-100, -100, 310, 200));
btnMenu.setClip(new Rectangle(211, -100, 100, 200));
menu.setMaxHeight(400);
menu.setMaxHeight(365);
menu.setMinWidth(545);
updatePane.visibleProperty().bind(UpdateChecker.outdatedProperty());
closeButton.setGraphic(SVG.close(Theme.whiteFillBinding(), 10, 10));
@ -154,9 +156,17 @@ public final class MainPage extends StackPane implements DecoratorPage {
.filter(version -> !version.isHidden())
.sorted((a, b) -> VersionNumber.COMPARATOR.compare(VersionNumber.asVersion(a.getId()), VersionNumber.asVersion(b.getId())))
.map(version -> {
StackPane pane = new StackPane();
BorderPane pane = new BorderPane();
GameItem item = new GameItem(repository.getProfile(), version.getId());
pane.getChildren().setAll(item);
pane.setLeft(item);
JFXButton settings = new JFXButton();
settings.setGraphic(SVG.gear(Theme.blackFillBinding(), -1, -1));
settings.getStyleClass().setAll("toggle-icon4");
settings.setOnMouseClicked(e -> {
Versions.modifyGameSettings(profile, version.getId());
popup.hide();
});
pane.setRight(settings);
pane.getStyleClass().setAll("menu-container");
item.setMouseTransparent(true);
RipplerContainer container = new RipplerContainer(pane);

View File

@ -87,8 +87,7 @@ public class GameListItem extends Control {
}
public void modifyGameSettings() {
Controllers.getVersionPage().load(version, profile);
Controllers.navigate(Controllers.getVersionPage());
Versions.modifyGameSettings(profile, version);
}
public void generateLaunchScript() {

View File

@ -27,7 +27,6 @@ import org.jackhuang.hmcl.mod.UnsupportedModpackException;
import org.jackhuang.hmcl.setting.Accounts;
import org.jackhuang.hmcl.setting.EnumGameDirectory;
import org.jackhuang.hmcl.setting.Profile;
import org.jackhuang.hmcl.setting.Profiles;
import org.jackhuang.hmcl.task.Schedulers;
import org.jackhuang.hmcl.task.Task;
import org.jackhuang.hmcl.task.TaskExecutor;
@ -134,4 +133,9 @@ public class Versions {
page.loadVersionSetting(profile, null);
Controllers.navigate(page);
}
public static void modifyGameSettings(Profile profile, String version) {
Controllers.getVersionPage().load(version, profile);
Controllers.navigate(Controllers.getVersionPage());
}
}