From c90db11651ceb180cdd973b93a1eec30a56e8b93 Mon Sep 17 00:00:00 2001 From: wjian23 Date: Sat, 14 Dec 2024 17:25:28 +0800 Subject: [PATCH] =?UTF-8?q?fix(widgets):=20=F0=9F=90=9B=20delay=20hover=20?= =?UTF-8?q?effests=20to=20show=20tooltips?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/src/builtin_widgets/tooltips.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/src/builtin_widgets/tooltips.rs b/core/src/builtin_widgets/tooltips.rs index 6335664c0..322c1da3b 100644 --- a/core/src/builtin_widgets/tooltips.rs +++ b/core/src/builtin_widgets/tooltips.rs @@ -12,8 +12,7 @@ class_names! { /// ```no_run /// use ribir::prelude::*; /// -/// let w = fn_widget! { -/// @Text { +/// let w = text! { /// text: "hover to show tooltips!", /// tooltips: "this is tooltips", /// } @@ -84,9 +83,10 @@ impl<'c> ComposeChild<'c> for Tooltips { let wnd = BuildCtx::get().window(); let u = watch!($child.is_hover()) + .delay(Duration::from_millis(150), AppCtx::scheduler()) .distinct_until_changed() - .subscribe(move |v| { - if v { + .subscribe(move |_| { + if $child.is_hover() { $this.show(wnd.clone()); } else { $this.hidden();