From edd95ad626a1a6992d04a1d87806ff91f25f4d0e Mon Sep 17 00:00:00 2001 From: Zkitefly <2573874409@qq.com> Date: Sun, 13 Oct 2024 21:57:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A8=A1=E7=BB=84=E7=AE=A1=E7=90=86=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E6=93=8D=E4=BD=9C=E6=9B=B4=E6=94=B9=E4=B8=BA=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E6=9B=B4=E6=96=B0=E5=90=8E=E8=A7=A6=E5=8F=91=20(#3221?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 更改为文本更新后触发 * 添加防抖 --- .../org/jackhuang/hmcl/ui/versions/ModListPageSkin.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/ModListPageSkin.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/ModListPageSkin.java index 4c35fe630..5cfaa1f1e 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/ModListPageSkin.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/ModListPageSkin.java @@ -19,6 +19,7 @@ package org.jackhuang.hmcl.ui.versions; import com.jfoenix.controls.*; import com.jfoenix.controls.datamodels.treetable.RecursiveTreeObject; +import javafx.animation.PauseTransition; import javafx.beans.binding.Bindings; import javafx.beans.property.BooleanProperty; import javafx.collections.ListChangeListener; @@ -33,6 +34,7 @@ import javafx.scene.image.ImageView; import javafx.scene.layout.HBox; import javafx.scene.layout.Priority; import javafx.scene.layout.StackPane; +import javafx.util.Duration; import org.jackhuang.hmcl.mod.LocalModFile; import org.jackhuang.hmcl.mod.ModLoaderType; import org.jackhuang.hmcl.mod.RemoteMod; @@ -113,7 +115,12 @@ class ModListPageSkin extends SkinBase { searchField = new JFXTextField(); searchField.setPromptText(i18n("search")); HBox.setHgrow(searchField, Priority.ALWAYS); - searchField.setOnAction(e -> search()); + PauseTransition pause = new PauseTransition(Duration.millis(100)); + pause.setOnFinished(e -> search()); + searchField.textProperty().addListener((observable, oldValue, newValue) -> { + pause.setRate(1); + pause.playFromStart(); + }); JFXButton closeSearchBar = createToolbarButton2(null, SVG.CLOSE, () -> {