From b8a3f2286fe0ec0e947ee38f9419fbfb232b4ed0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BE=9E=E5=BA=90?= <109708109+CiiLu@users.noreply.github.com> Date: Sun, 2 Aug 2026 21:54:51 +0800 Subject: [PATCH] =?UTF-8?q?(54)=20=E4=BC=8F=E7=BE=B2=E4=B9=98=E6=A1=B4?= =?UTF-8?q?=E6=BC=AA=E6=9C=AA=E5=B9=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/jfoenix/skins/JFXCheckBoxSkin.java | 42 +++++++++++-------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/HMCL/src/main/java/com/jfoenix/skins/JFXCheckBoxSkin.java b/HMCL/src/main/java/com/jfoenix/skins/JFXCheckBoxSkin.java index cb9837699e4..1f24a50f9f2 100644 --- a/HMCL/src/main/java/com/jfoenix/skins/JFXCheckBoxSkin.java +++ b/HMCL/src/main/java/com/jfoenix/skins/JFXCheckBoxSkin.java @@ -12,31 +12,20 @@ import com.jfoenix.transitions.CachedTransition; import com.jfoenix.transitions.JFXFillTransition; import com.jfoenix.utils.JFXNodeUtils; -import javafx.animation.Interpolator; -import javafx.animation.KeyFrame; -import javafx.animation.KeyValue; -import javafx.animation.Timeline; -import javafx.animation.Transition; +import javafx.animation.*; import javafx.beans.property.ReadOnlyBooleanProperty; import javafx.geometry.HPos; import javafx.geometry.Insets; import javafx.geometry.VPos; import javafx.scene.control.CheckBox; import javafx.scene.control.skin.CheckBoxSkin; -import javafx.scene.layout.AnchorPane; -import javafx.scene.layout.Background; -import javafx.scene.layout.BackgroundFill; -import javafx.scene.layout.Border; -import javafx.scene.layout.BorderStroke; -import javafx.scene.layout.BorderStrokeStyle; -import javafx.scene.layout.BorderWidths; -import javafx.scene.layout.CornerRadii; -import javafx.scene.layout.StackPane; +import javafx.scene.layout.*; import javafx.scene.paint.Color; import javafx.scene.shape.SVGPath; import javafx.util.Duration; import org.jackhuang.hmcl.theme.Themes; import org.jackhuang.hmcl.ui.FXUtils; +import org.jackhuang.hmcl.ui.animation.AnimationUtils; public class JFXCheckBoxSkin extends CheckBoxSkin { private final StackPane box = new StackPane(); @@ -186,15 +175,32 @@ private void playSelectAnimation(Boolean selection) { } JFXCheckBox control = (JFXCheckBox) this.getSkinnable(); - this.transition.setRate(selection ? 1.0 : -1.0); - this.select.setRate(selection ? 1.0 : -1.0); - this.transition.play(); - this.select.play(); + this.box.setBorder(new Border(new BorderStroke( selection ? control.getCheckedColor() : Themes.getColorScheme().getOnSurfaceVariant(), BorderStrokeStyle.SOLID, new CornerRadii(2.0), new BorderWidths(this.lineThick)))); + + if (!AnimationUtils.isAnimationEnabled()) { + if (selection) { + this.mark.setVisible(true); + this.mark.setScaleX(1.0); + this.mark.setScaleY(1.0); + JFXNodeUtils.updateBackground(box.getBackground(), box, control.getCheckedColor()); + } else { + this.mark.setVisible(false); + this.mark.setScaleX(0.0); + this.mark.setScaleY(0.0); + JFXNodeUtils.updateBackground(box.getBackground(), box, Color.TRANSPARENT); + } + return; + } + + this.transition.setRate(selection ? 1.0 : -1.0); + this.select.setRate(selection ? 1.0 : -1.0); + this.transition.play(); + this.select.play(); } private void createFillTransition() {