Skip to main content

ClickEvent

Enum ClickEvent 

Source
pub enum ClickEvent {
    Mouse(MouseClickEvent),
    Keyboard(KeyboardClickEvent),
    Touch(TouchClickEvent),
}
Expand description

重导出交互系统相关类型(Focusable、ClickArea 等) 点击事件,当鼠标按键或键盘按键按下并释放时生成, 或当触摸屏上识别到轻触手势时生成。

Variants§

§

Mouse(MouseClickEvent)

鼠标按键按下并释放触发的点击事件。

§

Keyboard(KeyboardClickEvent)

键盘按键按下并释放触发的点击事件。

§

Touch(TouchClickEvent)

触摸屏上识别的轻触手势触发的点击事件。

Implementations§

Source§

impl ClickEvent

Source

pub fn modifiers(&self) -> Modifiers

返回点击事件期间按住的修饰键

Keyboard:键盘点击事件始终没有修饰键。 Mouse:鼠标按键释放事件期间按住的修饰键。

Source

pub fn position(&self) -> Point<Pixels>

返回点击事件的位置

Keyboard:被点击碰撞框的左下角 Mouse:按钮释放时鼠标的位置。 Touch:轻触的位置。

Source

pub fn mouse_position(&self) -> Option<Point<Pixels>>

返回点击事件的鼠标位置

Keyboard:None Mouse:按钮释放时鼠标的位置。 Touch:None,触摸不是鼠标输入且没有光标。

Source

pub fn is_right_click(&self) -> bool

返回是否为右键点击

Keyboard:false Mouse:右键是否被按下并释放

Source

pub fn is_middle_click(&self) -> bool

返回是否为中键点击

Keyboard:false Mouse:中键是否被按下并释放

Source

pub fn is_secondary(&self) -> bool

返回点击是否为次要激活,即上下文菜单触发器: 鼠标的右键点击(macOS 的 ctrl-click 已由平台层转换为右键点击), 或触摸屏上的长按。

Source

pub fn standard_click(&self) -> bool

返回点击是否为标准点击

Keyboard:始终为 true Mouse:左键按下并释放 Touch:轻触但非长按

Source

pub fn first_focus(&self) -> bool

返回点击是否聚焦了元素

Keyboard:false,键盘点击仅在元素已聚焦时有效 Mouse:是否是首次聚焦点击 Touch:false,移动端窗口在可点击时已处于活动状态

Source

pub fn click_count(&self) -> usize

返回点击事件的点击次数

Keyboard:始终为 1 Mouse:MouseUpEvent 中的点击计数 Touch:连续轻触次数

Source

pub fn is_keyboard(&self) -> bool

返回点击事件是否由键盘事件生成

Trait Implementations§

Source§

impl Clone for ClickEvent

Source§

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)

Performs copy-assignment from source. Read more
Source§

impl Debug for ClickEvent

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ClickEvent

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

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().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more