pub struct PrimaryPointerState { /* private fields */ }Expand description
A stateful view of the primary pointer.
Implementations§
Source§impl PrimaryPointerState
impl PrimaryPointerState
Sourcepub fn is_just_pressed(&self, button: PointerButton) -> bool
pub fn is_just_pressed(&self, button: PointerButton) -> bool
Return true if the button was pressed within the last frame.
This corresponds to having received a PointerEvent::Down event
for that button on the primary pointing device.
Sourcepub fn is_just_released(&self, button: PointerButton) -> bool
pub fn is_just_released(&self, button: PointerButton) -> bool
Return true if the button was released within the last frame.
This corresponds to having received a PointerEvent::Up event
for that button on the primary pointing device.
Sourcepub fn is_auxiliary_just_pressed(&self) -> bool
pub fn is_auxiliary_just_pressed(&self) -> bool
Return true if the Auxiliary button (usually middle mouse) was
pressed within the last frame.
Sourcepub fn is_auxiliary_just_released(&self) -> bool
pub fn is_auxiliary_just_released(&self) -> bool
Return true if the Auxiliary button was released within the last frame.
Sourcepub fn is_primary_just_pressed(&self) -> bool
pub fn is_primary_just_pressed(&self) -> bool
Return true if the Primary button (usually left mouse) was
pressed within the last frame.
Sourcepub fn is_primary_just_released(&self) -> bool
pub fn is_primary_just_released(&self) -> bool
Return true if the Primary button was released within the last frame.
Sourcepub fn is_secondary_just_pressed(&self) -> bool
pub fn is_secondary_just_pressed(&self) -> bool
Return true if the Secondary button (usually right mouse) was
pressed within the last frame.
Sourcepub fn is_secondary_just_released(&self) -> bool
pub fn is_secondary_just_released(&self) -> bool
Return true if the Secondary button was released within the last frame.
Sourcepub fn is_any_down(&self) -> bool
pub fn is_any_down(&self) -> bool
Return true if any button is currently held down.
Sourcepub fn is_down(&self, button: PointerButton) -> bool
pub fn is_down(&self, button: PointerButton) -> bool
Return true if the specified button is currently held down.
Sourcepub fn clear_frame(&mut self)
pub fn clear_frame(&mut self)
Clear the per-frame state to prepare for a new frame.
Sourcepub fn current_position(&self) -> PhysicalPosition<f64>
pub fn current_position(&self) -> PhysicalPosition<f64>
Current position.
This will only give known positions.
Sourcepub fn current_logical_position(&self) -> LogicalPosition<f64>
pub fn current_logical_position(&self) -> LogicalPosition<f64>
Current position (in logical units).
This will only give known positions.
Sourcepub fn motion(&self) -> PhysicalPosition<f64>
pub fn motion(&self) -> PhysicalPosition<f64>
Relative motion this frame.
Sourcepub fn logical_motion(&self) -> LogicalPosition<f64>
pub fn logical_motion(&self) -> LogicalPosition<f64>
Relative motion this frame.
Sourcepub fn process_pointer_event(&mut self, event: PointerEvent)
pub fn process_pointer_event(&mut self, event: PointerEvent)
Update the state based on the given pointer event.
Only events from the primary pointer are processed. Press and release
events update the just_pressed, just_released, and down states.
Trait Implementations§
Source§impl Clone for PrimaryPointerState
impl Clone for PrimaryPointerState
Source§fn clone(&self) -> PrimaryPointerState
fn clone(&self) -> PrimaryPointerState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more