pub enum ClickEvent {
Mouse(MouseClickEvent),
Keyboard(KeyboardClickEvent),
Touch(TouchClickEvent),
}Expand description
重导出交互系统相关类型(Focusable、ClickArea 等) 点击事件,当鼠标按键或键盘按键按下并释放时生成, 或当触摸屏上识别到轻触手势时生成。
Variants§
Mouse(MouseClickEvent)
鼠标按键按下并释放触发的点击事件。
Keyboard(KeyboardClickEvent)
键盘按键按下并释放触发的点击事件。
Touch(TouchClickEvent)
触摸屏上识别的轻触手势触发的点击事件。
Implementations§
Source§impl ClickEvent
impl ClickEvent
Sourcepub fn modifiers(&self) -> Modifiers
pub fn modifiers(&self) -> Modifiers
返回点击事件期间按住的修饰键
Keyboard:键盘点击事件始终没有修饰键。
Mouse:鼠标按键释放事件期间按住的修饰键。
Sourcepub fn position(&self) -> Point<Pixels>
pub fn position(&self) -> Point<Pixels>
返回点击事件的位置
Keyboard:被点击碰撞框的左下角
Mouse:按钮释放时鼠标的位置。
Touch:轻触的位置。
Sourcepub fn mouse_position(&self) -> Option<Point<Pixels>>
pub fn mouse_position(&self) -> Option<Point<Pixels>>
返回点击事件的鼠标位置
Keyboard:None
Mouse:按钮释放时鼠标的位置。
Touch:None,触摸不是鼠标输入且没有光标。
Sourcepub fn is_right_click(&self) -> bool
pub fn is_right_click(&self) -> bool
返回是否为右键点击
Keyboard:false
Mouse:右键是否被按下并释放
Sourcepub fn is_middle_click(&self) -> bool
pub fn is_middle_click(&self) -> bool
返回是否为中键点击
Keyboard:false
Mouse:中键是否被按下并释放
Sourcepub fn is_secondary(&self) -> bool
pub fn is_secondary(&self) -> bool
返回点击是否为次要激活,即上下文菜单触发器: 鼠标的右键点击(macOS 的 ctrl-click 已由平台层转换为右键点击), 或触摸屏上的长按。
Sourcepub fn standard_click(&self) -> bool
pub fn standard_click(&self) -> bool
返回点击是否为标准点击
Keyboard:始终为 true
Mouse:左键按下并释放
Touch:轻触但非长按
Sourcepub fn first_focus(&self) -> bool
pub fn first_focus(&self) -> bool
返回点击是否聚焦了元素
Keyboard:false,键盘点击仅在元素已聚焦时有效
Mouse:是否是首次聚焦点击
Touch:false,移动端窗口在可点击时已处于活动状态
Sourcepub fn click_count(&self) -> usize
pub fn click_count(&self) -> usize
返回点击事件的点击次数
Keyboard:始终为 1
Mouse:MouseUpEvent 中的点击计数
Touch:连续轻触次数
Sourcepub fn is_keyboard(&self) -> bool
pub fn is_keyboard(&self) -> bool
返回点击事件是否由键盘事件生成
Trait Implementations§
Source§impl Clone for ClickEvent
impl Clone for ClickEvent
Source§fn clone(&self) -> ClickEvent
fn clone(&self) -> ClickEvent
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ClickEvent
impl Debug for ClickEvent
Auto Trait Implementations§
impl Freeze for ClickEvent
impl RefUnwindSafe for ClickEvent
impl Send for ClickEvent
impl Sync for ClickEvent
impl Unpin for ClickEvent
impl UnsafeUnpin for ClickEvent
impl UnwindSafe for ClickEvent
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().