mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-08 19:35:36 -04:00
在切换目录时确保主页版本列表切换菜单正确更新 (#3949)
This commit is contained in:
parent
3b3cc54cb5
commit
6124b6711f
@ -79,7 +79,9 @@ public final class MainPage extends StackPane implements DecoratorPage {
|
|||||||
private final ReadOnlyObjectWrapper<State> state = new ReadOnlyObjectWrapper<>();
|
private final ReadOnlyObjectWrapper<State> state = new ReadOnlyObjectWrapper<>();
|
||||||
|
|
||||||
private final PopupMenu menu = new PopupMenu();
|
private final PopupMenu menu = new PopupMenu();
|
||||||
private final JFXPopup popup = new JFXPopup(menu);
|
|
||||||
|
private final StackPane popupWrapper = new StackPane(menu);
|
||||||
|
private final JFXPopup popup = new JFXPopup(popupWrapper);
|
||||||
|
|
||||||
private final StringProperty currentGame = new SimpleStringProperty(this, "currentGame");
|
private final StringProperty currentGame = new SimpleStringProperty(this, "currentGame");
|
||||||
private final BooleanProperty showUpdate = new SimpleBooleanProperty(this, "showUpdate");
|
private final BooleanProperty showUpdate = new SimpleBooleanProperty(this, "showUpdate");
|
||||||
@ -321,15 +323,27 @@ public final class MainPage extends StackPane implements DecoratorPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void onMenu() {
|
private void onMenu() {
|
||||||
|
Node contentNode;
|
||||||
if (menu.getContent().isEmpty()) {
|
if (menu.getContent().isEmpty()) {
|
||||||
Label placeholder = new Label(i18n("version.empty"));
|
Label placeholder = new Label(i18n("version.empty"));
|
||||||
placeholder.setStyle("-fx-padding: 10px; -fx-text-fill: gray; -fx-font-style: italic;");
|
placeholder.setStyle("-fx-padding: 10px; -fx-text-fill: gray; -fx-font-style: italic;");
|
||||||
|
contentNode = placeholder;
|
||||||
popup.setPopupContent(placeholder);
|
|
||||||
} else {
|
} else {
|
||||||
popup.setPopupContent(menu);
|
contentNode = menu;
|
||||||
}
|
}
|
||||||
popup.show(menuButton, JFXPopup.PopupVPosition.BOTTOM, JFXPopup.PopupHPosition.RIGHT, 0, -menuButton.getHeight());
|
|
||||||
|
popupWrapper.getChildren().setAll(contentNode);
|
||||||
|
|
||||||
|
if (popup.isShowing()) {
|
||||||
|
popup.hide();
|
||||||
|
}
|
||||||
|
popup.show(
|
||||||
|
menuButton,
|
||||||
|
JFXPopup.PopupVPosition.BOTTOM,
|
||||||
|
JFXPopup.PopupHPosition.RIGHT,
|
||||||
|
0,
|
||||||
|
-menuButton.getHeight()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onUpgrade() {
|
private void onUpgrade() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user