FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    InteractionTracker

    struct · ferroui-base · v0.5.0

    struct InteractionTracker
    

    A position and a scale driven by input, inertia and requests (Microsoft.UI.Composition.Interactions.InteractionTracker).

    The main use is to bind visuals to it: an expression animation that references the tracker (set_reference_parameter("tracker", tracker)) reads tracker.Position, tracker.Scale and the other values of the tracker, e.g. -tracker.Position for the Offset of a scrolled visual.

    Deviation (winui-composition.md): WinUI runs the tracker in the compositor. Here it runs on the UI thread, ticking with the animation frames of the media context while it is in inertia or in a custom animation, and publishes its values into its property set (properties) after every change; a reference to the tracker in an expression is a reference to that property set.

    View source

    Members

    create

    fn create(compositor: &Rc<Compositor>) -> Rc<InteractionTracker>
    

    InteractionTracker.Create(compositor).

    Source

    create_with_owner

    fn create_with_owner(compositor: &Rc<Compositor>, owner: Rc<dyn IInteractionTrackerOwner>) -> Rc<InteractionTracker>
    

    InteractionTracker.CreateWithOwner(compositor, owner).

    Source

    compositor

    fn compositor(self: &Self) -> &Rc<Compositor>
    

    The compositor of the tracker.

    Source

    properties

    fn properties(self: &Self) -> &Rc<CompositionPropertySet>
    

    The property set the tracker publishes its values into, under the WinUI names (Position, Scale, PositionVelocityInPixelsPerSecond, ScaleVelocityInPercentPerSecond, MinPosition, MaxPosition, MinScale, MaxScale, NaturalRestingPosition, NaturalRestingScale, PositionInertiaDecayRate, ScaleInertiaDecayRate, IsPositionRoundingSuggested, IsInertiaFromImpulse).

    Deviation (winui-composition.md): in WinUI, Properties of a tracker is a property set of the application and the values are properties of the tracker itself; here the values live in this set, so entries the application adds must not use those names.

    Source

    owner

    fn owner(self: &Self) -> Option<Rc<dyn IInteractionTrackerOwner>>
    

    The owner given at creation.

    Source

    state

    fn state(self: &Self) -> InteractionTrackerState
    

    The current state (not a WinUI member, see InteractionTrackerState).

    Source

    interaction_sources

    fn interaction_sources(self: &Self) -> &CompositionInteractionSourceCollection
    

    The sources whose input drives the tracker.

    Source

    position

    fn position(self: &Self) -> Vector3
    

    The position (Position).

    Source

    position_velocity_in_pixels_per_second

    fn position_velocity_in_pixels_per_second(self: &Self) -> Vector3
    

    The velocity of the position (PositionVelocityInPixelsPerSecond).

    Source

    scale

    fn scale(self: &Self) -> f32
    

    The scale (Scale).

    Source

    scale_velocity_in_percent_per_second

    fn scale_velocity_in_percent_per_second(self: &Self) -> f32
    

    The velocity of the scale (ScaleVelocityInPercentPerSecond), in scale units per second.

    Source

    min_position

    fn min_position(self: &Self) -> Vector3
    

    The lower boundary of the position (MinPosition).

    Source

    set_min_position

    fn set_min_position(self: &Self, value: Vector3)
    

    Sets the lower boundary. The position is not moved by the change; the next request or inertia honours it.

    Source

    max_position

    fn max_position(self: &Self) -> Vector3
    

    The upper boundary of the position (MaxPosition).

    Source

    set_max_position

    fn set_max_position(self: &Self, value: Vector3)
    

    Source

    min_scale

    fn min_scale(self: &Self) -> f32
    

    The lower boundary of the scale (MinScale).

    Source

    set_min_scale

    fn set_min_scale(self: &Self, value: f32)
    

    Source

    max_scale

    fn max_scale(self: &Self) -> f32
    

    The upper boundary of the scale (MaxScale).

    Source

    set_max_scale

    fn set_max_scale(self: &Self, value: f32)
    

    Source

    natural_resting_position

    fn natural_resting_position(self: &Self) -> Vector3
    

    Where the natural decay of the velocity of the last inertia comes to rest, before the inertia modifiers and the boundaries (NaturalRestingPosition).

    Source

    natural_resting_scale

    fn natural_resting_scale(self: &Self) -> f32
    

    The natural resting scale of the last inertia (NaturalRestingScale).

    Source

    position_inertia_decay_rate

    fn position_inertia_decay_rate(self: &Self) -> Option<Vector3>
    

    The decay rate of the position velocity per axis (PositionInertiaDecayRate); None for the default (DEFAULT_INERTIA_DECAY_RATE).

    Source

    set_position_inertia_decay_rate

    fn set_position_inertia_decay_rate(self: &Self, value: Option<Vector3>)
    

    Source

    scale_inertia_decay_rate

    fn scale_inertia_decay_rate(self: &Self) -> Option<f32>
    

    The decay rate of the scale velocity (ScaleInertiaDecayRate).

    Source

    set_scale_inertia_decay_rate

    fn set_scale_inertia_decay_rate(self: &Self, value: Option<f32>)
    

    Source

    is_position_rounding_suggested

    fn is_position_rounding_suggested(self: &Self) -> bool
    

    Whether the position should be rounded to whole pixels: true while the tracker is idle (IsPositionRoundingSuggested).

    Source

    is_inertia_from_impulse

    fn is_inertia_from_impulse(self: &Self) -> bool
    

    Whether the current or last inertia comes from an impulse (IsInertiaFromImpulse).

    Source

    configure_position_x_inertia_modifiers

    fn configure_position_x_inertia_modifiers(self: &Self, modifiers: impl IntoIterator<Item = InteractionTrackerInertiaModifier>)
    

    ConfigurePositionXInertiaModifiers: the modifiers of the inertia of the X axis; an empty list removes them.

    Source

    configure_position_y_inertia_modifiers

    fn configure_position_y_inertia_modifiers(self: &Self, modifiers: impl IntoIterator<Item = InteractionTrackerInertiaModifier>)
    

    ConfigurePositionYInertiaModifiers.

    Source

    configure_scale_inertia_modifiers

    fn configure_scale_inertia_modifiers(self: &Self, modifiers: impl IntoIterator<Item = InteractionTrackerInertiaModifier>)
    

    ConfigureScaleInertiaModifiers.

    Source

    try_update_position

    fn try_update_position(self: &Self, value: Vector3) -> i32
    

    TryUpdatePosition(value): moves to value, clamped to the boundaries, and stops any inertia or custom animation. Ignored while interacting. Returns the id of the request.

    Source

    try_update_position_with_option

    fn try_update_position_with_option(self: &Self, value: Vector3, option: InteractionTrackerClampingOption) -> i32
    

    TryUpdatePosition(value, option).

    Source

    try_update_position_by

    fn try_update_position_by(self: &Self, amount: Vector3) -> i32
    

    TryUpdatePositionBy(amount): moves by amount, clamped.

    Source

    try_update_position_with_animation

    fn try_update_position_with_animation(self: &Self, animation: impl Into<InteractionTrackerAnimation>) -> i32
    

    TryUpdatePositionWithAnimation(animation): runs a custom animation of the position (a Vector3 key frame animation, or an expression). Ignored while interacting, or for an animation of another type.

    Source

    try_update_position_with_additional_velocity

    fn try_update_position_with_additional_velocity(self: &Self, velocity_in_pixels_per_second: Vector3) -> i32
    

    TryUpdatePositionWithAdditionalVelocity(velocity): adds velocity (pixels per second) to the current velocity and coasts in inertia. Ignored while interacting.

    Source

    try_update_scale

    fn try_update_scale(self: &Self, value: f32, center_point: Vector3) -> i32
    

    TryUpdateScale(value, centerPoint): scales to value, clamped to the scale boundaries, keeping center_point (in the coordinates of the viewport) in place. Ignored while interacting.

    Source

    try_update_scale_with_animation

    fn try_update_scale_with_animation(self: &Self, animation: impl Into<InteractionTrackerAnimation>, center_point: Vector3) -> i32
    

    TryUpdateScaleWithAnimation(animation, centerPoint): runs a custom animation of the scale (a scalar key frame animation, or an expression). Ignored while interacting, or for an animation of another type.

    Source

    try_update_scale_with_additional_velocity

    fn try_update_scale_with_additional_velocity(self: &Self, velocity_in_percent_per_second: f32, center_point: Vector3) -> i32
    

    TryUpdateScaleWithAdditionalVelocity(velocity, centerPoint): adds velocity (scale units per second) to the scale velocity and coasts in inertia around center_point. Ignored while interacting.

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • ClassDefaults
    • Borrow<T>
    • BorrowMut<T>
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • ErasedDestructor
    • IntoEither
    • AsCompositionObject

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.