pub struct TouchTransformArgs {
pub timestamp: DInstant,
pub window_id: WindowId,
pub device_id: DeviceId,
pub first_info: TouchTransformInfo,
pub latest_info: TouchTransformInfo,
pub velocity: [PxVector; 2],
pub scale_factor: Factor,
pub phase: TouchPhase,
pub hits: HitTestInfo,
pub target: InteractionPath,
pub capture: Option<CaptureInfo>,
pub modifiers: ModifiersState,
/* private fields */
}
Expand description
Arguments for TOUCH_TRANSFORM_EVENT
.
Fields§
§timestamp: DInstant
Instant the event happened.
window_id: WindowId
Id of window that received the touch events.
device_id: DeviceId
Id of the device that generated the touch events.
first_info: TouchTransformInfo
Info collected when the second touch point started.
latest_info: TouchTransformInfo
Latest update of the two points.
velocity: [PxVector; 2]
Velocity of the latest_info
touch points.
scale_factor: Factor
Scale factor used in the computed pixel values.
This is the window’s scale factor when the first touch started.
phase: TouchPhase
Gesture phase.
hits: HitTestInfo
Hit-test result for the center point between the first position of the two touches in the window when the gesture started.
target: InteractionPath
Full path to the top-most hit in hits
.
capture: Option<CaptureInfo>
Current pointer capture.
modifiers: ModifiersState
What modifier keys where pressed when this event happened.
Implementations§
source§impl TouchTransformArgs
impl TouchTransformArgs
sourcepub fn new(
timestamp: impl Into<DInstant>,
propagation_handle: EventPropagationHandle,
window_id: impl Into<WindowId>,
device_id: impl Into<DeviceId>,
first_info: impl Into<TouchTransformInfo>,
latest_info: impl Into<TouchTransformInfo>,
velocity: impl Into<[PxVector; 2]>,
scale_factor: impl Into<Factor>,
phase: impl Into<TouchPhase>,
hits: impl Into<HitTestInfo>,
target: impl Into<InteractionPath>,
capture: impl Into<Option<CaptureInfo>>,
modifiers: impl Into<ModifiersState>,
) -> Self
pub fn new( timestamp: impl Into<DInstant>, propagation_handle: EventPropagationHandle, window_id: impl Into<WindowId>, device_id: impl Into<DeviceId>, first_info: impl Into<TouchTransformInfo>, latest_info: impl Into<TouchTransformInfo>, velocity: impl Into<[PxVector; 2]>, scale_factor: impl Into<Factor>, phase: impl Into<TouchPhase>, hits: impl Into<HitTestInfo>, target: impl Into<InteractionPath>, capture: impl Into<Option<CaptureInfo>>, modifiers: impl Into<ModifiersState>, ) -> Self
New args from values that convert into the argument types.
sourcepub fn now(
window_id: impl Into<WindowId>,
device_id: impl Into<DeviceId>,
first_info: impl Into<TouchTransformInfo>,
latest_info: impl Into<TouchTransformInfo>,
velocity: impl Into<[PxVector; 2]>,
scale_factor: impl Into<Factor>,
phase: impl Into<TouchPhase>,
hits: impl Into<HitTestInfo>,
target: impl Into<InteractionPath>,
capture: impl Into<Option<CaptureInfo>>,
modifiers: impl Into<ModifiersState>,
) -> Self
pub fn now( window_id: impl Into<WindowId>, device_id: impl Into<DeviceId>, first_info: impl Into<TouchTransformInfo>, latest_info: impl Into<TouchTransformInfo>, velocity: impl Into<[PxVector; 2]>, scale_factor: impl Into<Factor>, phase: impl Into<TouchPhase>, hits: impl Into<HitTestInfo>, target: impl Into<InteractionPath>, capture: impl Into<Option<CaptureInfo>>, modifiers: impl Into<ModifiersState>, ) -> Self
Arguments for event that happened now (INSTANT.now
).
source§impl TouchTransformArgs
impl TouchTransformArgs
sourcepub fn capture_allows(&self) -> bool
pub fn capture_allows(&self) -> bool
sourcepub fn is_enabled(&self, widget_id: WidgetId) -> bool
pub fn is_enabled(&self, widget_id: WidgetId) -> bool
If the widget_id
is in the target
is enabled.
sourcepub fn is_disabled(&self, widget_id: WidgetId) -> bool
pub fn is_disabled(&self, widget_id: WidgetId) -> bool
If the widget_id
is in the target
is disabled.
sourcepub fn local_info(&self) -> [TouchTransformInfo; 2]
pub fn local_info(&self) -> [TouchTransformInfo; 2]
Gets the first_info
and latest_info
in the WIDGET
inner bounds space.
sourcepub fn translation(&self) -> Vector2D<f32, Px>
pub fn translation(&self) -> Vector2D<f32, Px>
Computes the translation to transform from first_info
to latest_info
.
sourcepub fn translation_x(&self) -> f32
pub fn translation_x(&self) -> f32
Computes the translation-x to transform from first_info
to latest_info
.
sourcepub fn translation_y(&self) -> f32
pub fn translation_y(&self) -> f32
Computes the translation-y to transform from first_info
to latest_info
.
sourcepub fn rotation(&self) -> AngleRadian
pub fn rotation(&self) -> AngleRadian
Computes the rotation to transform from first_info
to latest_info
.
sourcepub fn scale(&self) -> Factor
pub fn scale(&self) -> Factor
Computes the scale to transform from first_info
to latest_info
.
sourcepub fn scale_x(&self) -> Factor
pub fn scale_x(&self) -> Factor
Computes the scale-y to transform from first_info
to latest_info
.
sourcepub fn scale_y(&self) -> Factor
pub fn scale_y(&self) -> Factor
Computes the scale-y to transform from first_info
to latest_info
.
sourcepub fn transform(&self, mode: TouchTransformMode) -> PxTransform
pub fn transform(&self, mode: TouchTransformMode) -> PxTransform
Computes the transform from first_info
to latest_info
.
sourcepub fn local_transform(&self, mode: TouchTransformMode) -> PxTransform
pub fn local_transform(&self, mode: TouchTransformMode) -> PxTransform
Computes the transform between the local_info
values, rotates and scales around the latest center.
sourcepub fn translation_velocity(&self) -> PxVector
pub fn translation_velocity(&self) -> PxVector
Average velocity.
sourcepub fn translation_inertia_x(&self, deceleration: Dip) -> (Px, Duration)
pub fn translation_inertia_x(&self, deceleration: Dip) -> (Px, Duration)
Compute the final offset and duration for a fling animation that simulates inertia movement from the
translation_velocity().x
and deceleration
. Returns 0 if velocity less than min_fling_velocity
.
Deceleration is in dip/s, a good value is 1000. The recommended animation easing function
is |t| easing::ease_out(easing::quad, t)
.
sourcepub fn translation_inertia_y(&self, deceleration: Dip) -> (Px, Duration)
pub fn translation_inertia_y(&self, deceleration: Dip) -> (Px, Duration)
Compute the final offset and duration for a fling animation that simulates inertia movement from the
translation_velocity().y
and deceleration
. Returns 0 if velocity less than min_fling_velocity
.
Deceleration is in dip/s, a good value is 1000. The recommended animation easing function is
|t| easing::ease_out(easing::quad, t)
.
sourcepub fn is_start(&self) -> bool
pub fn is_start(&self) -> bool
If the phase
is start.
Note that the latest_info
may already be different from first_info
if the gesture
detector awaited to disambiguate before starting the gesture.
Trait Implementations§
source§impl AnyEventArgs for TouchTransformArgs
impl AnyEventArgs for TouchTransformArgs
source§fn delivery_list(&self, list: &mut UpdateDeliveryList)
fn delivery_list(&self, list: &mut UpdateDeliveryList)
source§fn clone_any(&self) -> Box<dyn AnyEventArgs>
fn clone_any(&self) -> Box<dyn AnyEventArgs>
source§fn propagation(&self) -> &EventPropagationHandle
fn propagation(&self) -> &EventPropagationHandle
source§impl Clone for TouchTransformArgs
impl Clone for TouchTransformArgs
source§fn clone(&self) -> TouchTransformArgs
fn clone(&self) -> TouchTransformArgs
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for TouchTransformArgs
impl Debug for TouchTransformArgs
Auto Trait Implementations§
impl Freeze for TouchTransformArgs
impl RefUnwindSafe for TouchTransformArgs
impl Send for TouchTransformArgs
impl Sync for TouchTransformArgs
impl Unpin for TouchTransformArgs
impl UnwindSafe for TouchTransformArgs
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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