修复使用 JavaFX 25 时游戏下载界面布局错误的问题 (#4508)
This commit is contained in:
@@ -22,6 +22,7 @@ import javafx.beans.Observable;
|
|||||||
import javafx.beans.binding.Bindings;
|
import javafx.beans.binding.Bindings;
|
||||||
import javafx.beans.property.ObjectProperty;
|
import javafx.beans.property.ObjectProperty;
|
||||||
import javafx.beans.property.SimpleObjectProperty;
|
import javafx.beans.property.SimpleObjectProperty;
|
||||||
|
import javafx.beans.value.ChangeListener;
|
||||||
import javafx.css.PseudoClass;
|
import javafx.css.PseudoClass;
|
||||||
import javafx.geometry.Insets;
|
import javafx.geometry.Insets;
|
||||||
import javafx.geometry.Pos;
|
import javafx.geometry.Pos;
|
||||||
@@ -318,7 +319,9 @@ public class InstallerItem extends Control {
|
|||||||
private static final class InstallerItemSkin extends SkinBase<InstallerItem> {
|
private static final class InstallerItemSkin extends SkinBase<InstallerItem> {
|
||||||
private static final PseudoClass LIST_ITEM = PseudoClass.getPseudoClass("list-item");
|
private static final PseudoClass LIST_ITEM = PseudoClass.getPseudoClass("list-item");
|
||||||
private static final PseudoClass CARD = PseudoClass.getPseudoClass("card");
|
private static final PseudoClass CARD = PseudoClass.getPseudoClass("card");
|
||||||
private static final WeakListenerHolder holder = new WeakListenerHolder();
|
|
||||||
|
@SuppressWarnings({"FieldCanBeLocal", "unused"})
|
||||||
|
private final ChangeListener<Number> holder;
|
||||||
|
|
||||||
InstallerItemSkin(InstallerItem control) {
|
InstallerItemSkin(InstallerItem control) {
|
||||||
super(control);
|
super(control);
|
||||||
@@ -326,9 +329,10 @@ public class InstallerItem extends Control {
|
|||||||
Pane pane;
|
Pane pane;
|
||||||
if (control.style == Style.CARD) {
|
if (control.style == Style.CARD) {
|
||||||
pane = new VBox();
|
pane = new VBox();
|
||||||
holder.add(FXUtils.onWeakChange(pane.widthProperty(), v -> FXUtils.setLimitHeight(pane, v.doubleValue() * 0.7)));
|
holder = FXUtils.onWeakChangeAndOperate(pane.widthProperty(), v -> FXUtils.setLimitHeight(pane, v.doubleValue() * 0.7));
|
||||||
} else {
|
} else {
|
||||||
pane = new HBox();
|
pane = new HBox();
|
||||||
|
holder = null;
|
||||||
}
|
}
|
||||||
pane.getStyleClass().add("installer-item");
|
pane.getStyleClass().add("installer-item");
|
||||||
RipplerContainer container = new RipplerContainer(pane);
|
RipplerContainer container = new RipplerContainer(pane);
|
||||||
|
|||||||
@@ -119,20 +119,15 @@ public abstract class AbstractInstallersPage extends Control implements WizardPa
|
|||||||
{
|
{
|
||||||
InstallerItem[] libraries = control.group.getLibraries();
|
InstallerItem[] libraries = control.group.getLibraries();
|
||||||
|
|
||||||
FlowPane libraryPane = new FlowPane(libraries);
|
FlowPane libraryPane = new FlowPane(16, 16, libraries);
|
||||||
libraryPane.setVgap(16);
|
ScrollPane scrollPane = new ScrollPane(libraryPane);
|
||||||
libraryPane.setHgap(16);
|
scrollPane.setFitToWidth(true);
|
||||||
|
scrollPane.setFitToHeight(true);
|
||||||
|
BorderPane.setMargin(scrollPane, new Insets(16, 0, 16, 0));
|
||||||
|
root.setCenter(scrollPane);
|
||||||
|
|
||||||
if (libraries.length <= 8) {
|
if (libraries.length <= 8)
|
||||||
BorderPane.setMargin(libraryPane, new Insets(16, 0, 16, 0));
|
scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
|
||||||
root.setCenter(libraryPane);
|
|
||||||
} else {
|
|
||||||
ScrollPane scrollPane = new ScrollPane(libraryPane);
|
|
||||||
scrollPane.setFitToWidth(true);
|
|
||||||
scrollPane.setFitToHeight(true);
|
|
||||||
BorderPane.setMargin(scrollPane, new Insets(16, 0, 16, 0));
|
|
||||||
root.setCenter(scrollPane);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user