pub enum InputEvent {
Show 29 variants
PointerDown {
x: i16,
y: i16,
},
PointerMove {
x: i16,
y: i16,
},
PointerUp {
x: i16,
y: i16,
},
PointerSecondaryDown {
x: i16,
y: i16,
},
PointerSecondaryUp {
x: i16,
y: i16,
},
PointerLeave,
PointerCancel,
PointerKindChanged(PointerKind),
Scroll {
x: i16,
y: i16,
delta_y: i16,
},
ScrollX {
x: i16,
y: i16,
delta_x: i16,
},
KeyDown(KeyCode),
KeyUp(KeyCode),
ModifiersChanged(KeyModifiers),
Backspace,
Delete,
TextCommit(char),
ImeEnabled,
ImeDisabled,
ImePreedit(ImePreedit),
NavigateBack,
SafeAreaChanged(SafeAreaInsets),
KeyboardInsetChanged(i16),
Pinch {
x: i16,
y: i16,
delta_scale_x1000: i16,
},
Rotate {
x: i16,
y: i16,
delta_deg10: i16,
},
ScrollPixel {
x: i16,
y: i16,
dx: i16,
dy: i16,
},
FileHovered {
x: i16,
y: i16,
},
FileDropped {
x: i16,
y: i16,
},
FileHoverCancelled,
SystemThemeChanged {
dark: bool,
},
}Expand description
统一输入事件枚举(支持完整触摸手势生命周期、滚轮、物理按键焦点导航、原生 IME 组合输入、移动端安全区与系统返回)。
Variants§
PointerDown
指针/手指按下。
PointerMove
指针/手指移动或拖拽。
PointerUp
指针/手指抬起。
PointerSecondaryDown
鼠标右键(次键)按下。
PointerSecondaryUp
鼠标右键(次键)抬起。
PointerLeave
指针移出当前窗口/表面区域(清除悬停状态)。
PointerCancel
指针/手势取消。
PointerKindChanged(PointerKind)
更新当前指针输入设备来源类型(区分桌面 Mouse / Pen 与触控屏 Touch)。
Scroll
鼠标滚轮或编码器滚动。
ScrollX
水平滚轮滚动。
KeyDown(KeyCode)
物理按键或旋钮按键按下。
KeyUp(KeyCode)
物理按键释放。
ModifiersChanged(KeyModifiers)
键盘修饰键状态变更(Ctrl / Alt / Shift / Super)。
Backspace
退格删除一个字符(面向处于聚焦态的文本输入框)。
Delete
删除光标后一个字符(Delete 键)。
TextCommit(char)
输入法(IME)提交单个字符。
ImeEnabled
系统输入法(IME)会话激活。
ImeDisabled
系统输入法(IME)会话关闭/失焦(清空预编辑态)。
ImePreedit(ImePreedit)
系统输入法(IME)组合输入预编辑文本更新(如拼音 "zhongwen" 及选区光标)。
系统级返回导航请求(Android 返回键 / 预测性返回手势 / iOS 左边缘右滑返回 / Web 浏览器 popstate)。
SafeAreaChanged(SafeAreaInsets)
移动端异形屏安全区域发生变更(如屏幕旋转、状态栏显隐切换)。
KeyboardInsetChanged(i16)
移动端屏幕软键盘弹出高度发生变更(0 表示软键盘收起)。
Pinch
双指捏合/触控板缩放手势(delta_scale_x1000 为千分比增量,如 +50 表示放大 5%)。
Rotate
双指旋转手势(delta_deg10 单位 0.1° 顺时针增量)。
ScrollPixel
触控板高精度像素级双轴平滑滚动。
FileHovered
外部 OS 文件拖拽悬停在窗口上方。
FileDropped
外部 OS 文件在窗口指定坐标处放下(路径列表通过引擎 dropped_files() 读取)。
FileHoverCancelled
外部 OS 文件拖拽离开窗口取消。
SystemThemeChanged
操作系统深浅色主题热切换通知。
Trait Implementations§
Source§impl Clone for InputEvent
impl Clone for InputEvent
impl Copy for InputEvent
Source§impl Debug for InputEvent
impl Debug for InputEvent
impl Eq for InputEvent
Source§impl PartialEq for InputEvent
impl PartialEq for InputEvent
impl StructuralPartialEq for InputEvent
Auto Trait Implementations§
impl Forget for InputEvent
impl Freeze for InputEvent
impl Move for InputEvent
impl RefUnwindSafe for InputEvent
impl Send for InputEvent
impl Sync for InputEvent
impl Unpin for InputEvent
impl UnsafeUnpin for InputEvent
impl UnwindSafe for InputEvent
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> FluentBuilder for T
impl<T> FluentBuilder for T
Source§fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Self
fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Self
当
condition 为 true 时执行闭包修饰自身,否则原样返回。Source§fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Self
fn when_else( self, condition: bool, then: impl FnOnce(Self) -> Self, else_fn: impl FnOnce(Self) -> Self, ) -> Self
根据
condition 在两个修饰分支之间二选一。Source§fn when_some<O>(
self,
option: Option<O>,
then: impl FnOnce(Self, O) -> Self,
) -> Self
fn when_some<O>( self, option: Option<O>, then: impl FnOnce(Self, O) -> Self, ) -> Self
当
option 为 Some(value) 时执行闭包修饰自身,否则原样返回。