#[non_exhaustive]pub struct PointerFrame {
pub cursor: Option<Vec2>,
pub delta: Vec2,
pub clicked: bool,
pub pressed: bool,
pub drag_began: bool,
pub drag_started: bool,
pub dragging: bool,
pub tapped: bool,
pub double_tapped: bool,
pub long_pressed: bool,
pub touch_position: Option<Vec2>,
pub contacts: u8,
}Expand description
Pointer and click state resolved for one frame.
Carries the cursor position, the per-frame pointer movement, and click-vs-drag
flags that manipulation and picking need. Filled by ViewportInput::resolve
from state it already tracks, so consumers no longer hand-roll a
click-vs-drag threshold.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.cursor: Option<Vec2>Cursor position in viewport-local pixels. None when the pointer is outside.
delta: Vec2Pointer movement in viewport pixels accumulated this frame.
clicked: boolTrue on the frame the primary button was released as a click: the pointer never got the drag threshold away from where it was pressed.
pressed: boolTrue on the frame the primary button was pressed.
drag_began: boolTrue on the first frame a held primary press has moved the drag threshold or more from where it went down. Fires at most once per press, and a press that fires it never ends as a click.
drag_started: booluse pressed, or drag_began for the frame the press becomes a drag
True on the frame the primary button was pressed. Same value as
pressed; despite the name, the pointer need not have
moved. See drag_began for the frame a press
becomes a drag.
dragging: boolTrue while the primary button is held.
tapped: boolTrue on the frame a touch contact lifted without having travelled far enough
to be a drag. The touch counterpart of clicked.
A double tap sets this as well, on its second tap: telling the two apart needs a delay that only the application can decide to pay.
double_tapped: boolTrue on the frame a second tap landed soon enough, and close enough, to the one before it.
Needs a clock: only resolves when the frame is begun with
ViewportInput::begin_frame_at.
long_pressed: boolTrue on the frame a contact has been down and still long enough to count as a long press. Fires once, while the finger is still down, and suppresses the tap that contact would otherwise have produced when it lifts.
Needs a clock: only resolves when the frame is begun with
ViewportInput::begin_frame_at.
touch_position: Option<Vec2>Where the last touch event landed, in viewport-local pixels. None until one
arrives; it is not cleared when the contact lifts, so a tap can be
hit-tested on the frame it is reported.
contacts: u8How many touch contacts are down.
Trait Implementations§
Source§impl Clone for PointerFrame
impl Clone for PointerFrame
Source§fn clone(&self) -> PointerFrame
fn clone(&self) -> PointerFrame
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more