pub struct InputSample {
pub position: LogicalPosition,
pub screen_position: LogicalPosition,
pub timestamp: Instant,
pub button_state: u8,
pub event_id: u64,
pub pressure: f32,
pub tilt: (f32, f32),
pub touch_radius: (f32, f32),
}Expand description
Single input sample with position and timestamp
Fields§
§position: LogicalPositionPosition in logical coordinates (window-local, Y=0 at top of window)
screen_position: LogicalPositionPosition in virtual screen coordinates (Y=0 at top of primary monitor).
Computed as window_position + position at the time the sample is recorded.
This is stable during window drags because window_pos + cursor_local
always equals the true screen position, even when the window moves.
All coordinates are in logical pixels (HiDPI-independent). On Wayland, this is an estimate (compositor does not expose global position).
timestamp: InstantTimestamp when this sample was recorded (from ExternalSystemCallbacks)
Mouse button state (bitfield: 0x01 = left, 0x02 = right, 0x04 = middle)
event_id: u64Unique, monotonic event ID for ordering (atomic counter)
pressure: f32Pen/stylus pressure (0.0 to 1.0, 0.5 = default for mouse)
tilt: (f32, f32)Pen/stylus tilt angles in degrees (x_tilt, y_tilt) Range: typically -90.0 to 90.0, (0.0, 0.0) = perpendicular
touch_radius: (f32, f32)Touch contact radius in logical pixels (width, height) For mouse input, this is (0.0, 0.0)
Trait Implementations§
Source§impl Clone for InputSample
impl Clone for InputSample
Source§fn clone(&self) -> InputSample
fn clone(&self) -> InputSample
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for InputSample
impl Debug for InputSample
Source§impl PartialEq for InputSample
impl PartialEq for InputSample
impl StructuralPartialEq for InputSample
Auto Trait Implementations§
impl Freeze for InputSample
impl RefUnwindSafe for InputSample
impl Send for InputSample
impl Sync for InputSample
impl Unpin for InputSample
impl UnsafeUnpin for InputSample
impl UnwindSafe for InputSample
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more