# InteractionTracker

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/rendering/composition/interactions/struct-interactiontracker/

**struct** · [`ferroui-base`](/docs/0.5.0/api/ferroui-base/) · v0.5.0

```rust
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](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/interactions/interaction_tracker.rs#L636)

## Members

- [`create`](#function-create)
- [`create_with_owner`](#function-create_with_owner)
- [`compositor`](#function-compositor)
- [`properties`](#function-properties)
- [`owner`](#function-owner)
- [`state`](#function-state)
- [`interaction_sources`](#function-interaction_sources)
- [`position`](#function-position)
- [`position_velocity_in_pixels_per_second`](#function-position_velocity_in_pixels_per_second)
- [`scale`](#function-scale)
- [`scale_velocity_in_percent_per_second`](#function-scale_velocity_in_percent_per_second)
- [`min_position`](#function-min_position)
- [`set_min_position`](#function-set_min_position)
- [`max_position`](#function-max_position)
- [`set_max_position`](#function-set_max_position)
- [`min_scale`](#function-min_scale)
- [`set_min_scale`](#function-set_min_scale)
- [`max_scale`](#function-max_scale)
- [`set_max_scale`](#function-set_max_scale)
- [`natural_resting_position`](#function-natural_resting_position)
- [`natural_resting_scale`](#function-natural_resting_scale)
- [`position_inertia_decay_rate`](#function-position_inertia_decay_rate)
- [`set_position_inertia_decay_rate`](#function-set_position_inertia_decay_rate)
- [`scale_inertia_decay_rate`](#function-scale_inertia_decay_rate)
- [`set_scale_inertia_decay_rate`](#function-set_scale_inertia_decay_rate)
- [`is_position_rounding_suggested`](#function-is_position_rounding_suggested)
- [`is_inertia_from_impulse`](#function-is_inertia_from_impulse)
- [`configure_position_x_inertia_modifiers`](#function-configure_position_x_inertia_modifiers)
- [`configure_position_y_inertia_modifiers`](#function-configure_position_y_inertia_modifiers)
- [`configure_scale_inertia_modifiers`](#function-configure_scale_inertia_modifiers)
- [`try_update_position`](#function-try_update_position)
- [`try_update_position_with_option`](#function-try_update_position_with_option)
- [`try_update_position_by`](#function-try_update_position_by)
- [`try_update_position_with_animation`](#function-try_update_position_with_animation)
- [`try_update_position_with_additional_velocity`](#function-try_update_position_with_additional_velocity)
- [`try_update_scale`](#function-try_update_scale)
- [`try_update_scale_with_animation`](#function-try_update_scale_with_animation)
- [`try_update_scale_with_additional_velocity`](#function-try_update_scale_with_additional_velocity)

<a id="function-create"></a>

### create

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

`InteractionTracker.Create(compositor)`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/interactions/interaction_tracker.rs#L664)

<a id="function-create_with_owner"></a>

### create_with_owner

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

`InteractionTracker.CreateWithOwner(compositor, owner)`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/interactions/interaction_tracker.rs#L669)

<a id="function-compositor"></a>

### compositor

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

The compositor of the tracker.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/interactions/interaction_tracker.rs#L704)

<a id="function-properties"></a>

### properties

```rust
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](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/interactions/interaction_tracker.rs#L720)

<a id="function-owner"></a>

### owner

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

The owner given at creation.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/interactions/interaction_tracker.rs#L725)

<a id="function-state"></a>

### state

```rust
fn state(self: &Self) -> InteractionTrackerState
```

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

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/interactions/interaction_tracker.rs#L731)

<a id="function-interaction_sources"></a>

### interaction_sources

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

The sources whose input drives the tracker.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/interactions/interaction_tracker.rs#L736)

<a id="function-position"></a>

### position

```rust
fn position(self: &Self) -> Vector3
```

The position (`Position`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/interactions/interaction_tracker.rs#L770)

<a id="function-position_velocity_in_pixels_per_second"></a>

### position_velocity_in_pixels_per_second

```rust
fn position_velocity_in_pixels_per_second(self: &Self) -> Vector3
```

The velocity of the position (`PositionVelocityInPixelsPerSecond`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/interactions/interaction_tracker.rs#L775)

<a id="function-scale"></a>

### scale

```rust
fn scale(self: &Self) -> f32
```

The scale (`Scale`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/interactions/interaction_tracker.rs#L780)

<a id="function-scale_velocity_in_percent_per_second"></a>

### scale_velocity_in_percent_per_second

```rust
fn scale_velocity_in_percent_per_second(self: &Self) -> f32
```

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

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/interactions/interaction_tracker.rs#L786)

<a id="function-min_position"></a>

### min_position

```rust
fn min_position(self: &Self) -> Vector3
```

The lower boundary of the position (`MinPosition`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/interactions/interaction_tracker.rs#L791)

<a id="function-set_min_position"></a>

### set_min_position

```rust
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](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/interactions/interaction_tracker.rs#L797)

<a id="function-max_position"></a>

### max_position

```rust
fn max_position(self: &Self) -> Vector3
```

The upper boundary of the position (`MaxPosition`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/interactions/interaction_tracker.rs#L802)

<a id="function-set_max_position"></a>

### set_max_position

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/interactions/interaction_tracker.rs#L806)

<a id="function-min_scale"></a>

### min_scale

```rust
fn min_scale(self: &Self) -> f32
```

The lower boundary of the scale (`MinScale`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/interactions/interaction_tracker.rs#L811)

<a id="function-set_min_scale"></a>

### set_min_scale

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/interactions/interaction_tracker.rs#L815)

<a id="function-max_scale"></a>

### max_scale

```rust
fn max_scale(self: &Self) -> f32
```

The upper boundary of the scale (`MaxScale`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/interactions/interaction_tracker.rs#L820)

<a id="function-set_max_scale"></a>

### set_max_scale

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/interactions/interaction_tracker.rs#L824)

<a id="function-natural_resting_position"></a>

### natural_resting_position

```rust
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](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/interactions/interaction_tracker.rs#L831)

<a id="function-natural_resting_scale"></a>

### natural_resting_scale

```rust
fn natural_resting_scale(self: &Self) -> f32
```

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

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/interactions/interaction_tracker.rs#L836)

<a id="function-position_inertia_decay_rate"></a>

### position_inertia_decay_rate

```rust
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](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/interactions/interaction_tracker.rs#L843)

<a id="function-set_position_inertia_decay_rate"></a>

### set_position_inertia_decay_rate

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/interactions/interaction_tracker.rs#L847)

<a id="function-scale_inertia_decay_rate"></a>

### scale_inertia_decay_rate

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

The decay rate of the scale velocity (`ScaleInertiaDecayRate`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/interactions/interaction_tracker.rs#L852)

<a id="function-set_scale_inertia_decay_rate"></a>

### set_scale_inertia_decay_rate

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/interactions/interaction_tracker.rs#L856)

<a id="function-is_position_rounding_suggested"></a>

### is_position_rounding_suggested

```rust
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](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/interactions/interaction_tracker.rs#L862)

<a id="function-is_inertia_from_impulse"></a>

### is_inertia_from_impulse

```rust
fn is_inertia_from_impulse(self: &Self) -> bool
```

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

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/interactions/interaction_tracker.rs#L868)

<a id="function-configure_position_x_inertia_modifiers"></a>

### configure_position_x_inertia_modifiers

```rust
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](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/interactions/interaction_tracker.rs#L876)

<a id="function-configure_position_y_inertia_modifiers"></a>

### configure_position_y_inertia_modifiers

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

`ConfigurePositionYInertiaModifiers`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/interactions/interaction_tracker.rs#L881)

<a id="function-configure_scale_inertia_modifiers"></a>

### configure_scale_inertia_modifiers

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

`ConfigureScaleInertiaModifiers`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/interactions/interaction_tracker.rs#L886)

<a id="function-try_update_position"></a>

### try_update_position

```rust
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](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/interactions/interaction_tracker.rs#L912)

<a id="function-try_update_position_with_option"></a>

### try_update_position_with_option

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

`TryUpdatePosition(value, option)`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/interactions/interaction_tracker.rs#L917)

<a id="function-try_update_position_by"></a>

### try_update_position_by

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

`TryUpdatePositionBy(amount)`: moves by `amount`, clamped.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/interactions/interaction_tracker.rs#L927)

<a id="function-try_update_position_with_animation"></a>

### try_update_position_with_animation

```rust
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](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/interactions/interaction_tracker.rs#L955)

<a id="function-try_update_position_with_additional_velocity"></a>

### try_update_position_with_additional_velocity

```rust
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](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/interactions/interaction_tracker.rs#L988)

<a id="function-try_update_scale"></a>

### try_update_scale

```rust
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](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/interactions/interaction_tracker.rs#L1009)

<a id="function-try_update_scale_with_animation"></a>

### try_update_scale_with_animation

```rust
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](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/interactions/interaction_tracker.rs#L1047)

<a id="function-try_update_scale_with_additional_velocity"></a>

### try_update_scale_with_additional_velocity

```rust
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](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/interactions/interaction_tracker.rs#L1074)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ErasedDestructor`
- `IntoEither`
- [`AsCompositionObject`](/docs/0.5.0/api/ferroui-base/rendering/composition/trait-ascompositionobject/)

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
