pub enum ScriptEvent {
PointerMove {
x: f32,
y: f32,
},
Mouse {
x: f32,
y: f32,
button: String,
pressed: bool,
modifiers: u8,
},
Wheel {
x: f32,
y: f32,
dx: f32,
dy: f32,
modifiers: u8,
},
Key {
key: String,
pressed: bool,
modifiers: u8,
},
Ime {
kind: String,
text: String,
cursor: Option<usize>,
},
Focus {
focused: bool,
},
CursorLeft,
}Expand description
脚本事件枚举。字段名与真实 ShellEvent 对齐,便于 Agent 生成脚本。
Variants§
PointerMove
光标移动:{"type":"pointer_move","x":10,"y":20}
Mouse
鼠标按下/抬起:{"type":"mouse","x":10,"y":20,"button":"left","pressed":true}
Wheel
滚轮:{"type":"wheel","x":10,"y":20,"dx":0,"dy":16}
Key
键盘:{"type":"key","key":"Enter","pressed":true}
Ime
IME:{"type":"ime","kind":"commit","text":"你好"}
Focus
窗口焦点:{"type":"focus","focused":false}
CursorLeft
光标离开客户区:{"type":"cursor_left"}
Implementations§
Source§impl ScriptEvent
impl ScriptEvent
Sourcepub fn to_shell_event(&self) -> Result<ShellEvent, String>
pub fn to_shell_event(&self) -> Result<ShellEvent, String>
翻译成平台无关事件。错误在这里集中产生,回放路径只做注入。
Trait Implementations§
Source§impl Clone for ScriptEvent
impl Clone for ScriptEvent
Source§impl Debug for ScriptEvent
impl Debug for ScriptEvent
Source§impl<'de> Deserialize<'de> for ScriptEvent
impl<'de> Deserialize<'de> for ScriptEvent
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for ScriptEvent
impl PartialEq for ScriptEvent
impl StructuralPartialEq for ScriptEvent
Auto Trait Implementations§
impl Forget for ScriptEvent
impl Freeze for ScriptEvent
impl Move for ScriptEvent
impl RefUnwindSafe for ScriptEvent
impl Send for ScriptEvent
impl Sync for ScriptEvent
impl Unpin for ScriptEvent
impl UnsafeUnpin for ScriptEvent
impl UnwindSafe for ScriptEvent
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