pub struct PointerState {
pub time: u64,
pub position: PhysicalPosition<f64>,
pub buttons: PointerButtons,
pub modifiers: Modifiers,
pub count: u8,
pub contact_geometry: ContactGeometry,
pub orientation: PointerOrientation,
pub pressure: f32,
pub tangential_pressure: f32,
pub scale_factor: f64,
}Expand description
A single pointer state.
Fields§
§time: u64u64 nanoseconds real time.
The base time is not important, except by convention, and should generally be the same at least for states originating from the same device.
position: PhysicalPosition<f64>Position.
Pressed buttons.
modifiers: ModifiersModifiers state.
count: u8Click or tap count associated with the pointer.
contact_geometry: ContactGeometryThe size of an input, usually touch.
If this is not provided by the underlying API, platform, or device, then it should be a single pixel.
orientation: PointerOrientationOrientation.
pressure: f32Normalized pressure in range 0..1.
Where pressure is not reported by the platform, it is always 0.5 when activated and 0.0 when not.
tangential_pressure: f32Normalized ‘tangential pressure’ in range -1..1.
This is an arbitrary parameter and, despite its name, it may not originate from a pressure sensitive control. This is often controlled by something like a wheel on the barrel of an ‘airbrush’ style pen.
scale_factor: f64The scale factor of the window/screen where this pointer event occurred.
Implementations§
Source§impl PointerState
impl PointerState
Sourcepub fn logical_point(&self) -> Point
pub fn logical_point(&self) -> Point
Returns the pointer position as a logical kurbo::Point.
The position is converted from physical pixels to logical coordinates using the state’s scale factor.
Sourcepub fn physical_point(&self) -> Point
pub fn physical_point(&self) -> Point
Returns the pointer position as a physical kurbo::Point.
Sourcepub fn logical_position(&self) -> LogicalPosition<f64>
pub fn logical_position(&self) -> LogicalPosition<f64>
Returns the pointer position in logical coordinates.
This converts the physical position to logical coordinates using the state’s scale factor, providing DPI-independent positioning.
Trait Implementations§
Source§impl Clone for PointerState
impl Clone for PointerState
Source§fn clone(&self) -> PointerState
fn clone(&self) -> PointerState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more