#[repr(C)]pub struct PenState {
pub position: LogicalPosition,
pub pressure: f32,
pub tilt: PenTilt,
pub in_contact: bool,
pub is_eraser: bool,
pub barrel_button_pressed: bool,
pub device_id: u64,
pub tangential_pressure: f32,
pub barrel_roll_rad: f32,
pub tool_id: u32,
}Expand description
State of pen/stylus input
Fields§
§position: LogicalPositionCurrent pen position
pressure: f32Current pressure (0.0 to 1.0)
tilt: PenTiltCurrent tilt angles (x_tilt, y_tilt) in degrees
in_contact: boolWhether pen is in contact with surface
is_eraser: boolWhether pen is inverted (eraser mode)
Whether barrel button is pressed
device_id: u64Unique identifier for this pen device
tangential_pressure: f32Tangential / cylinder pressure (0.0 to 1.0). Wacom Air Brush wheel,
Surface Slim Pen 2 secondary axis. 0.0 means “not reported”.
Maps to W3C PointerEvent.tangentialPressure.
barrel_roll_rad: f32Barrel roll angle in radians (–π to π). Wacom Art Pen rotation,
Surface Pen barrel-roll axis. 0.0 means “not reported” (devices
that do report it sweep through the full range as the user rolls
the pen — the resting state isn’t necessarily zero, so callers
should compare deltas, not absolute values).
Maps to W3C PointerEvent.twist (in radians, not degrees).
tool_id: u32Per-tool identity for hand-held pens that report it (Wintab GUID,
Apple Pencil session id, S-Pen serial). 0 means “not reported”.
Distinct from device_id so callers can both identify the
hardware (device_id) and which tip / lead / button cluster is
in use (tool_id).
Trait Implementations§
impl Copy for PenState
impl StructuralPartialEq for PenState
Auto Trait Implementations§
impl Freeze for PenState
impl RefUnwindSafe for PenState
impl Send for PenState
impl Sync for PenState
impl Unpin for PenState
impl UnsafeUnpin for PenState
impl UnwindSafe for PenState
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