From c6050a201b46e8ebcb8d24cce3e63cf33efb4ef4 Mon Sep 17 00:00:00 2001 From: Glavo Date: Sun, 14 Dec 2025 21:46:50 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"=E4=BF=AE=E5=A4=8D=20TransitionPane?= =?UTF-8?q?=20=E5=8A=A8=E7=94=BB=E8=A2=AB=E6=89=93=E6=96=AD=E6=97=B6?= =?UTF-8?q?=E8=8A=82=E7=82=B9=E7=8A=B6=E6=80=81=E5=BC=82=E5=B8=B8=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20(#4957)"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 18000fae30361abbe03477d28b331ec67839aecd. --- .../hmcl/ui/animation/TransitionPane.java | 24 ++++++------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/animation/TransitionPane.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/animation/TransitionPane.java index 2a5fe168e5..2cda33e6ac 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/animation/TransitionPane.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/animation/TransitionPane.java @@ -31,7 +31,6 @@ public class TransitionPane extends StackPane { private Node currentNode; - private Animation oldAnimation; public TransitionPane() { FXUtils.setOverflowHidden(this); @@ -51,11 +50,6 @@ public final void setContent(Node newView, AnimationProducer transition, Duratio public void setContent(Node newView, AnimationProducer transition, Duration duration, Interpolator interpolator) { - if (oldAnimation != null) { - oldAnimation.stop(); - oldAnimation = null; - } - Node previousNode = currentNode != newView && getWidth() > 0 && getHeight() > 0 ? currentNode : null; currentNode = newView; @@ -86,19 +80,15 @@ public void setContent(Node newView, AnimationProducer transition, previousNode, newView, duration, interpolator); - newAnimation.statusProperty().addListener((observable, oldValue, newValue) -> { - if (oldValue == Animation.Status.RUNNING && newValue != Animation.Status.RUNNING) { - setMouseTransparent(false); - getChildren().remove(previousNode); - - if (cacheHint != null) { - newView.setCache(false); - } + newAnimation.setOnFinished(e -> { + setMouseTransparent(false); + getChildren().remove(previousNode); + + if (cacheHint != null) { + newView.setCache(false); } }); - - oldAnimation = newAnimation; - newAnimation.play(); + FXUtils.playAnimation(this, "transition_pane", newAnimation); }); }