1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
use crate::geometry::Point;
use winit::dpi::PhysicalPosition;
use winit::event::{DeviceId, PointerSource};
#[derive(Clone, Debug)]
pub struct PointerMoved {
pub device_id: Option<DeviceId>,
/// (x,y) coordinates in pixels relative to the top-left corner of the window. Because the
/// range of this data is limited by the display area, and it may have been
/// transformed by the OS to implement effects such as pointer acceleration, it
/// should not be used to implement non-pointer-like interactions such as 3D camera
/// control. For that, consider [`DeviceEvent::PointerMotion`].
///
/// ## Platform-specific
///
/// **Web:** Doesn't take into account CSS [`border`], [`padding`], or [`transform`].
///
/// [`border`]: https://developer.mozilla.org/en-US/docs/Web/CSS/border
/// [`padding`]: https://developer.mozilla.org/en-US/docs/Web/CSS/padding
/// [`transform`]: https://developer.mozilla.org/en-US/docs/Web/CSS/transform
pub position: Point,
pub source: PointerSource,
pub primary: bool,
}
impl PointerMoved {
pub fn new(
device_id: Option<DeviceId>,
position: PhysicalPosition<f64>,
source: PointerSource,
primary: bool,
) -> Self {
Self {
device_id,
position: position.into(),
source,
primary,
}
}
}