pub struct FloatingCloseHandle { /* private fields */ }Expand description
Helper handle for floating overlays (Tooltip / Popover / Popconfirm / Dropdown 等),封装点击空白关闭 + ESC 关闭的共用逻辑。
使用方式:
- 在组件内部创建
let handle = use_floating_close_handle(open_signal); - 在触发区或浮层内部交互前调用
handle.mark_internal_click(),避免当前事件被 document 级别的 click 监听误判为空白点击; - 在键盘事件中检测 ESC 并调用
handle.close()。
Implementations§
Source§impl FloatingCloseHandle
impl FloatingCloseHandle
Sourcepub fn mark_internal_click(&self)
pub fn mark_internal_click(&self)
标记当前 click/交互来源于组件内部,避免 document click handler 立即关闭。
Trait Implementations§
Source§impl Clone for FloatingCloseHandle
impl Clone for FloatingCloseHandle
Source§fn clone(&self) -> FloatingCloseHandle
fn clone(&self) -> FloatingCloseHandle
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for FloatingCloseHandle
Auto Trait Implementations§
impl Freeze for FloatingCloseHandle
impl !RefUnwindSafe for FloatingCloseHandle
impl !Send for FloatingCloseHandle
impl !Sync for FloatingCloseHandle
impl Unpin for FloatingCloseHandle
impl !UnwindSafe for FloatingCloseHandle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> InitializeFromFunction<T> for T
impl<T> InitializeFromFunction<T> for T
Source§fn initialize_from_function(f: fn() -> T) -> T
fn initialize_from_function(f: fn() -> T) -> T
Create an instance of this type from an initialization function
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<Ret> SpawnIfAsync<(), Ret> for Ret
impl<Ret> SpawnIfAsync<(), Ret> for Ret
Source§impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
Source§fn super_from(input: T) -> O
fn super_from(input: T) -> O
Convert from a type to another type.
Source§impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
Source§fn super_into(self) -> O
fn super_into(self) -> O
Convert from a type to another type.