mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-08-03 03:16:35 -04:00
优化主页公告关闭按钮 (#4064)
This commit is contained in:
parent
e10f1dac20
commit
3b17e0a897
@ -29,7 +29,6 @@ import javafx.collections.ObservableList;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Cursor;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.image.ImageView;
|
||||
@ -125,18 +124,16 @@ public final class MainPage extends StackPane implements DecoratorPage {
|
||||
titleBar.getStyleClass().add("title");
|
||||
titleBar.setLeft(new Label(title));
|
||||
|
||||
Node hideNode = SVG.CLOSE.createIcon(Theme.blackFill(), 20);
|
||||
hideNode.setCursor(Cursor.HAND);
|
||||
titleBar.setRight(hideNode);
|
||||
FXUtils.onClicked(hideNode, () -> {
|
||||
if (announcementPane != null) {
|
||||
if (Metadata.isDev()) {
|
||||
config().getShownTips().put(ANNOUNCEMENT, Metadata.VERSION);
|
||||
}
|
||||
|
||||
announcementPane.setContent(new StackPane(), ContainerAnimations.FADE);
|
||||
JFXButton btnHide = new JFXButton();
|
||||
btnHide.setOnAction(e -> {
|
||||
announcementPane.setContent(new StackPane(), ContainerAnimations.FADE);
|
||||
if (Metadata.isDev()) {
|
||||
config().getShownTips().put(ANNOUNCEMENT, Metadata.VERSION);
|
||||
}
|
||||
});
|
||||
btnHide.getStyleClass().add("announcement-close-button");
|
||||
btnHide.setGraphic(SVG.CLOSE.createIcon(Theme.blackFill(), 20));
|
||||
titleBar.setRight(btnHide);
|
||||
|
||||
TextFlow body = FXUtils.segmentToTextFlow(content, Controllers::onHyperlinkAction);
|
||||
body.setLineSpacing(4);
|
||||
|
@ -1080,6 +1080,23 @@
|
||||
-jfx-mask-type: CIRCLE;
|
||||
}
|
||||
|
||||
.announcement-close-button {
|
||||
-fx-announcement-close-button-size: 20px;
|
||||
-fx-pref-width: -fx-announcement-close-button-size;
|
||||
-fx-max-width: -fx-announcement-close-button-size;
|
||||
-fx-min-width: -fx-announcement-close-button-size;
|
||||
-fx-pref-height: -fx-announcement-close-button-size;
|
||||
-fx-max-height: -fx-announcement-close-button-size;
|
||||
-fx-min-height: -fx-announcement-close-button-size;
|
||||
-fx-background-radius: 50px;
|
||||
-fx-background-color: transparent;
|
||||
}
|
||||
|
||||
.announcement-close-button .jfx-rippler {
|
||||
-jfx-rippler-fill: -fx-base-check-color;
|
||||
-jfx-mask-type: CIRCLE;
|
||||
}
|
||||
|
||||
.transparent {
|
||||
-fx-background-color: null;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user