Skip to content
Merged
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 @@ -39,34 +39,16 @@
import javafx.scene.image.Image;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.scene.layout.Region;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.*;
import javafx.stage.FileChooser;
import javafx.stage.Stage;
import javafx.util.Duration;
import org.jackhuang.hmcl.theme.Theme;
import org.jackhuang.hmcl.theme.ThemePackAuthor;
import org.jackhuang.hmcl.theme.ThemePackExporter;
import org.jackhuang.hmcl.theme.ThemePackManager;
import org.jackhuang.hmcl.theme.ThemePackManifest;
import org.jackhuang.hmcl.theme.ThemePackResource;
import org.jackhuang.hmcl.theme.Themes;
import org.jackhuang.hmcl.ui.FXUtils;
import org.jackhuang.hmcl.ui.ListPageBase;
import org.jackhuang.hmcl.ui.SVG;
import org.jackhuang.hmcl.ui.SVGContainer;
import org.jackhuang.hmcl.ui.Controllers;
import org.jackhuang.hmcl.theme.*;
import org.jackhuang.hmcl.ui.*;
import org.jackhuang.hmcl.ui.animation.ContainerAnimations;
import org.jackhuang.hmcl.ui.animation.TransitionPane;
import org.jackhuang.hmcl.ui.construct.ComponentList;
import org.jackhuang.hmcl.ui.construct.DialogCloseEvent;
import org.jackhuang.hmcl.ui.construct.ImageContainer;
import org.jackhuang.hmcl.ui.construct.*;
import org.jackhuang.hmcl.ui.construct.MessageDialogPane.MessageType;
import org.jackhuang.hmcl.ui.construct.SpinnerPane;
import org.jackhuang.hmcl.ui.construct.TwoLineListItem;
import org.jackhuang.hmcl.ui.decorator.DecoratorPage;
import org.jackhuang.hmcl.util.StringUtils;
import org.jackhuang.hmcl.util.TaskCancellationAction;
Expand All @@ -76,18 +58,11 @@

import java.io.IOException;
import java.nio.file.Path;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.*;
import java.util.function.Predicate;
import java.util.stream.Collectors;

import static org.jackhuang.hmcl.ui.FXUtils.ignoreEvent;
import static org.jackhuang.hmcl.ui.FXUtils.onEscPressed;
import static org.jackhuang.hmcl.ui.FXUtils.runInFX;
import static org.jackhuang.hmcl.ui.FXUtils.*;
import static org.jackhuang.hmcl.ui.ToolbarListPageSkin.createToolbarButton2;
import static org.jackhuang.hmcl.util.i18n.I18n.i18n;
import static org.jackhuang.hmcl.util.logging.Logger.LOG;
Expand Down Expand Up @@ -650,11 +625,14 @@ private ThemePackItemCell(ThemePackManagementPage page) {
BorderPane root = new BorderPane();
root.getStyleClass().add("md-list-cell");
root.setPadding(new Insets(8));
this.graphic = root;

var ripplerContainer = new RipplerContainer(root);
this.graphic = ripplerContainer;

HBox center = new HBox();
center.setSpacing(8);
center.setAlignment(Pos.CENTER_LEFT);
center.setMouseTransparent(true);
root.setCenter(center);

icon.setMouseTransparent(true);
Expand All @@ -664,7 +642,7 @@ private ThemePackItemCell(ThemePackManagementPage page) {
center.getChildren().setAll(icon, content);
HBox.setHgrow(content, Priority.ALWAYS);
center.setCursor(Cursor.HAND);
FXUtils.onClicked(center, () -> {
FXUtils.onClicked(ripplerContainer, () -> {

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 Prevent action buttons from triggering row selection

For non-built-in packs, the reveal/delete buttons are children of the root wrapped by this RipplerContainer. FXUtils.onClicked installs a bubbling MOUSE_CLICKED handler, while button actions fire from the button itself, so a primary click on either action button can also reach this handler and call selectThemePack, opening the apply/details dialog after reveal/delete. Keep the row-click handler limited to the non-button area or filter/consume clicks originating from the action buttons.

Useful? React with 👍 / 👎.

ThemePackManager.InstalledThemePack themePack = getItem();
if (themePack != null) {
page.selectThemePack(themePack);
Expand Down Expand Up @@ -696,8 +674,12 @@ private ThemePackItemCell(ThemePackManagementPage page) {
/// Updates this cell for one installed theme pack.
@Override
protected void updateItem(ThemePackManager.@Nullable InstalledThemePack themePack, boolean empty) {
var currentItem = getItem();

super.updateItem(themePack, empty);

if (Objects.equals(getItem(), currentItem)) return;

content.getTags().clear();
iconImage.setImage(null);
iconFallback.setVisible(false);
Expand Down