mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-08-04 03:46:57 -04:00
右键主页“启动游戏”按钮时展开版本列表菜单 (#3854)
This commit is contained in:
parent
435790aa03
commit
91135b961e
@ -26,12 +26,15 @@ import javafx.beans.binding.Bindings;
|
|||||||
import javafx.beans.property.*;
|
import javafx.beans.property.*;
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
|
import javafx.event.EventHandler;
|
||||||
import javafx.geometry.Insets;
|
import javafx.geometry.Insets;
|
||||||
import javafx.geometry.Pos;
|
import javafx.geometry.Pos;
|
||||||
import javafx.scene.Cursor;
|
import javafx.scene.Cursor;
|
||||||
import javafx.scene.Node;
|
import javafx.scene.Node;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.image.ImageView;
|
import javafx.scene.image.ImageView;
|
||||||
|
import javafx.scene.input.MouseButton;
|
||||||
|
import javafx.scene.input.MouseEvent;
|
||||||
import javafx.scene.layout.BorderPane;
|
import javafx.scene.layout.BorderPane;
|
||||||
import javafx.scene.layout.HBox;
|
import javafx.scene.layout.HBox;
|
||||||
import javafx.scene.layout.StackPane;
|
import javafx.scene.layout.StackPane;
|
||||||
@ -254,6 +257,15 @@ public final class MainPage extends StackPane implements DecoratorPage {
|
|||||||
FXUtils.installFastTooltip(menuButton, i18n("version.switch"));
|
FXUtils.installFastTooltip(menuButton, i18n("version.switch"));
|
||||||
menuButton.setGraphic(graphic);
|
menuButton.setGraphic(graphic);
|
||||||
|
|
||||||
|
EventHandler<MouseEvent> secondaryClickHandle = event -> {
|
||||||
|
if (event.getButton() == MouseButton.SECONDARY && event.getClickCount() == 1) {
|
||||||
|
menuButton.fire();
|
||||||
|
event.consume();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
launchButton.addEventHandler(MouseEvent.MOUSE_CLICKED, secondaryClickHandle);
|
||||||
|
menuButton.addEventHandler(MouseEvent.MOUSE_CLICKED, secondaryClickHandle);
|
||||||
|
|
||||||
launchPane.getChildren().setAll(launchButton, separator, menuButton);
|
launchPane.getChildren().setAll(launchButton, separator, menuButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user