-
Notifications
You must be signed in to change notification settings - Fork 898
Feat: Added rippler for AccountListItemSkin #6306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
433082d
246b29b
eed477a
5f20c14
76569a9
9e216c9
6d5a115
1510661
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,7 @@ | |
| import com.jfoenix.controls.JFXButton; | ||
| import com.jfoenix.controls.JFXRadioButton; | ||
| import com.jfoenix.effects.JFXDepthManager; | ||
|
|
||
| import javafx.beans.binding.Bindings; | ||
| import javafx.geometry.Pos; | ||
| import javafx.scene.Cursor; | ||
|
|
@@ -29,6 +30,7 @@ | |
| import javafx.scene.control.Tooltip; | ||
| import javafx.scene.layout.BorderPane; | ||
| import javafx.scene.layout.HBox; | ||
| import javafx.scene.layout.Region; | ||
| import javafx.scene.layout.VBox; | ||
| import org.jackhuang.hmcl.auth.Account; | ||
| import org.jackhuang.hmcl.auth.authlibinjector.AuthlibInjectorAccount; | ||
|
|
@@ -41,6 +43,7 @@ | |
| import org.jackhuang.hmcl.ui.Controllers; | ||
| import org.jackhuang.hmcl.ui.FXUtils; | ||
| import org.jackhuang.hmcl.ui.SVG; | ||
| import org.jackhuang.hmcl.ui.construct.RipplerContainer; | ||
| import org.jackhuang.hmcl.ui.construct.SpinnerPane; | ||
| import org.jackhuang.hmcl.util.javafx.BindingMapping; | ||
|
|
||
|
|
@@ -52,8 +55,13 @@ public AccountListItemSkin(AccountListItem skinnable) { | |
| super(skinnable); | ||
|
|
||
| BorderPane root = new BorderPane(); | ||
| root.setCursor(Cursor.HAND); | ||
| FXUtils.onClicked(root, skinnable::fire); | ||
| root.setPickOnBounds(false); | ||
| RipplerContainer rootRippler = new RipplerContainer(root); | ||
|
|
||
| rootRippler.setPickOnBounds(true); | ||
| rootRippler.setCursor(Cursor.HAND); | ||
| FXUtils.setOverflowHidden(rootRippler, 8); | ||
| FXUtils.onClicked(rootRippler, skinnable::fire); | ||
|
KSSJW marked this conversation as resolved.
|
||
|
|
||
|
KSSJW marked this conversation as resolved.
|
||
| JFXRadioButton chkSelected = new JFXRadioButton(); | ||
| chkSelected.setMouseTransparent(true); | ||
|
|
@@ -64,6 +72,7 @@ public AccountListItemSkin(AccountListItem skinnable) { | |
| HBox center = new HBox(); | ||
| center.setSpacing(8); | ||
| center.setAlignment(Pos.CENTER_LEFT); | ||
| center.setMouseTransparent(true); | ||
|
KSSJW marked this conversation as resolved.
|
||
|
|
||
| Canvas canvas = new Canvas(32, 32); | ||
| TexturesLoader.bindAvatar(canvas, skinnable.getAccount()); | ||
|
|
@@ -78,7 +87,7 @@ public AccountListItemSkin(AccountListItem skinnable) { | |
| Tooltip tooltip = new Tooltip(); | ||
| AuthlibInjectorServer server = ((AuthlibInjectorAccount) skinnable.getAccount()).getServer(); | ||
| tooltip.textProperty().bind(BindingMapping.of(server, AuthlibInjectorServer::toString)); | ||
| FXUtils.installSlowTooltip(subtitle, tooltip); | ||
| FXUtils.installSlowTooltip(rootRippler, tooltip); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
For AuthlibInjector accounts this installs the server tooltip on the whole row container. The action buttons below also install their own tooltips, but JavaFX tooltip handlers are attached to mouse events on each node, so when the mouse moves over a descendant button the row's handler can run as well and activate the parent server tooltip instead of the button label. This regresses the move/refresh/upload/copy/delete tooltips for these rows; keep the server tooltip scoped to the text/center area rather than the entire Useful? React with 👍 / 👎. |
||
| } | ||
| VBox item = new VBox(title, subtitle); | ||
| item.getStyleClass().add("two-line-list-item"); | ||
|
|
@@ -171,11 +180,16 @@ public AccountListItemSkin(AccountListItem skinnable) { | |
| right.getChildren().add(btnRemove); | ||
| root.setRight(right); | ||
|
|
||
| root.getStyleClass().add("card"); | ||
| root.setStyle("-fx-padding: 8 8 8 0;"); | ||
| JFXDepthManager.setDepth(root, 1); | ||
|
|
||
| getChildren().setAll(root); | ||
| Region background = new Region(); | ||
| background.setMouseTransparent(true); | ||
| background.setStyle("-fx-background-color: -monet-surface-container-low-transparent-80; -fx-background-radius: 4;"); | ||
|
KSSJW marked this conversation as resolved.
|
||
|
|
||
| rootRippler.getChildren().add(0, background); | ||
| JFXDepthManager.setDepth(rootRippler, 1); | ||
|
|
||
| getChildren().setAll(rootRippler); | ||
|
KSSJW marked this conversation as resolved.
|
||
| } | ||
|
|
||
| /// Moves the account between local and user account files. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.