lighthouse_protocol/input/mouse_event.rs
1use serde::{Deserialize, Serialize};
2
3use crate::{Delta, Pos};
4
5use super::{EventSource, MouseButton};
6
7/// A mouse event.
8#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
9#[serde(rename_all = "camelCase")]
10pub struct MouseEvent {
11 /// The client identifier.
12 pub source: EventSource,
13 /// Whether the button was pressed.
14 pub down: bool,
15 /// Whether the mouse pointer was locked (e.g. to the frontend's canvas)
16 pub pointer_locked: bool,
17 /// The mouse button.
18 pub button: MouseButton,
19 /// The mouse position on the lighthouse grid.
20 pub pos: Pos<f64>,
21 /// The mouse movement on the lighthouse grid.
22 pub movement: Delta<f64>,
23}