修复 InstallerItem 的 Rippler 没有正常显示的问题 (#5184)

Co-authored-by: Glavo <zjx001202@gmail.com>
This commit is contained in:
辞庐
2026-01-10 21:21:48 +08:00
committed by GitHub
parent db2e2d89ee
commit 3e393982e0
2 changed files with 11 additions and 1 deletions

View File

@@ -18,6 +18,7 @@
package org.jackhuang.hmcl.ui; package org.jackhuang.hmcl.ui;
import com.jfoenix.controls.JFXButton; import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXRippler;
import javafx.beans.Observable; import javafx.beans.Observable;
import javafx.beans.binding.Bindings; import javafx.beans.binding.Bindings;
import javafx.beans.property.ObjectProperty; import javafx.beans.property.ObjectProperty;
@@ -335,6 +336,7 @@ public class InstallerItem extends Control {
} }
pane.getStyleClass().add("installer-item"); pane.getStyleClass().add("installer-item");
RipplerContainer container = new RipplerContainer(pane); RipplerContainer container = new RipplerContainer(pane);
container.setPosition(JFXRippler.RipplerPos.FRONT);
getChildren().setAll(container); getChildren().setAll(container);
pane.pseudoClassStateChanged(LIST_ITEM, control.style == Style.LIST_ITEM); pane.pseudoClassStateChanged(LIST_ITEM, control.style == Style.LIST_ITEM);

View File

@@ -144,12 +144,20 @@ public class RipplerContainer extends StackPane {
} }
protected void updateChildren() { protected void updateChildren() {
getChildren().addAll(buttonContainer, getContainer()); if (buttonRippler.getPosition() == JFXRippler.RipplerPos.BACK)
getChildren().setAll(buttonContainer, getContainer());
else
getChildren().setAll(getContainer(), buttonContainer);
for (int i = 1; i < getChildren().size(); ++i) for (int i = 1; i < getChildren().size(); ++i)
getChildren().get(i).setPickOnBounds(false); getChildren().get(i).setPickOnBounds(false);
} }
public void setPosition(JFXRippler.RipplerPos pos) {
buttonRippler.setPosition(pos);
updateChildren();
}
public Node getContainer() { public Node getContainer() {
return container.get(); return container.get();
} }