Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;

Expand All @@ -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);
Comment thread
KSSJW marked this conversation as resolved.

rootRippler.setPickOnBounds(true);
rootRippler.setCursor(Cursor.HAND);
FXUtils.setOverflowHidden(rootRippler, 8);
FXUtils.onClicked(rootRippler, skinnable::fire);
Comment thread
KSSJW marked this conversation as resolved.

Comment thread
KSSJW marked this conversation as resolved.
JFXRadioButton chkSelected = new JFXRadioButton();
chkSelected.setMouseTransparent(true);
Expand All @@ -64,6 +72,7 @@ public AccountListItemSkin(AccountListItem skinnable) {
HBox center = new HBox();
center.setSpacing(8);
center.setAlignment(Pos.CENTER_LEFT);
center.setMouseTransparent(true);
Comment thread
KSSJW marked this conversation as resolved.

Canvas canvas = new Canvas(32, 32);
TexturesLoader.bindAvatar(canvas, skinnable.getAccount());
Expand All @@ -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);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep server tooltip off action buttons

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 rootRippler.

Useful? React with 👍 / 👎.

}
VBox item = new VBox(title, subtitle);
item.getStyleClass().add("two-line-list-item");
Expand Down Expand Up @@ -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;");
Comment thread
KSSJW marked this conversation as resolved.

rootRippler.getChildren().add(0, background);
JFXDepthManager.setDepth(rootRippler, 1);

getChildren().setAll(rootRippler);
Comment thread
KSSJW marked this conversation as resolved.
}

/// Moves the account between local and user account files.
Expand Down