# VisualInteractionSource

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

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

```rust
struct VisualInteractionSource
```

The input of the element of a visual, redirected to the interaction
trackers the source is added to
(`Microsoft.UI.Composition.Interactions.VisualInteractionSource`).

A drag starts with `try_redirect_for_manipulation`,
called from a pointer pressed handler: the source captures the pointer to
the element and follows its moves until it is released. Dragging content
up increases `Position.Y` of the trackers, as scrolling does. The mouse
wheel is redirected without a call when `ManipulationRedirectionMode`
includes it.

Deviation (winui-composition.md): WinUI receives the input in the
compositor once redirected. Here the source listens to the routed pointer
events of the element (handled ones too) and drives the trackers on the
UI thread; the element is the one of the visual (the element whose
composition visual it is, or of its nearest ancestor) or the one given to
`create_for_element`.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/interactions/visual_interaction_source.rs#L162)

## Members

- [`create`](#function-create)
- [`create_for_element`](#function-create_for_element)
- [`element`](#function-element)
- [`source`](#function-source)
- [`compositor`](#function-compositor)
- [`position_x_source_mode`](#function-position_x_source_mode)
- [`set_position_x_source_mode`](#function-set_position_x_source_mode)
- [`position_y_source_mode`](#function-position_y_source_mode)
- [`set_position_y_source_mode`](#function-set_position_y_source_mode)
- [`scale_source_mode`](#function-scale_source_mode)
- [`set_scale_source_mode`](#function-set_scale_source_mode)
- [`position_x_chaining_mode`](#function-position_x_chaining_mode)
- [`set_position_x_chaining_mode`](#function-set_position_x_chaining_mode)
- [`position_y_chaining_mode`](#function-position_y_chaining_mode)
- [`set_position_y_chaining_mode`](#function-set_position_y_chaining_mode)
- [`scale_chaining_mode`](#function-scale_chaining_mode)
- [`set_scale_chaining_mode`](#function-set_scale_chaining_mode)
- [`manipulation_redirection_mode`](#function-manipulation_redirection_mode)
- [`set_manipulation_redirection_mode`](#function-set_manipulation_redirection_mode)
- [`is_position_x_rails_enabled`](#function-is_position_x_rails_enabled)
- [`set_is_position_x_rails_enabled`](#function-set_is_position_x_rails_enabled)
- [`is_position_y_rails_enabled`](#function-is_position_y_rails_enabled)
- [`set_is_position_y_rails_enabled`](#function-set_is_position_y_rails_enabled)
- [`pointer_wheel_config`](#function-pointer_wheel_config)
- [`delta_position`](#function-delta_position)
- [`delta_scale`](#function-delta_scale)
- [`position`](#function-position)
- [`position_velocity`](#function-position_velocity)
- [`scale`](#function-scale)
- [`scale_velocity`](#function-scale_velocity)
- [`try_redirect_for_manipulation`](#function-try_redirect_for_manipulation)
- [`try_redirect_for_manipulation_point`](#function-try_redirect_for_manipulation_point)

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

### create

```rust
fn create(source: &Rc<CompositionVisual>) -> Rc<VisualInteractionSource>
```

`VisualInteractionSource.Create(source)`: a source for the input of
the element of `source`.

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

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

### create_for_element

```rust
fn create_for_element(source: &Rc<CompositionVisual>, element: &Ref<InputElement>) -> Rc<VisualInteractionSource>
```

A source for the input of `element`, shown by `source` (not a WinUI
member): for a visual that is not, or not yet, the composition visual
of an element or below one.

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

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

### element

```rust
fn element(self: &Self) -> Option<Ref<InputElement>>
```

The element whose input the source redirects, if it is known and
alive. Looked up again from the visual while it is not known.

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

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

### source

```rust
fn source(self: &Self) -> &Rc<CompositionVisual>
```

The visual the source was created for (`Source`).

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

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

### compositor

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

The compositor of the visual.

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

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

### position_x_source_mode

```rust
fn position_x_source_mode(self: &Self) -> InteractionSourceMode
```

`PositionXSourceMode`.

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

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

### set_position_x_source_mode

```rust
fn set_position_x_source_mode(self: &Self, value: InteractionSourceMode)
```



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

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

### position_y_source_mode

```rust
fn position_y_source_mode(self: &Self) -> InteractionSourceMode
```

`PositionYSourceMode`.

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

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

### set_position_y_source_mode

```rust
fn set_position_y_source_mode(self: &Self, value: InteractionSourceMode)
```



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

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

### scale_source_mode

```rust
fn scale_source_mode(self: &Self) -> InteractionSourceMode
```

`ScaleSourceMode`. Only the Ctrl + mouse wheel scales: pinch input
is not redirected.

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

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

### set_scale_source_mode

```rust
fn set_scale_source_mode(self: &Self, value: InteractionSourceMode)
```



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

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

### position_x_chaining_mode

```rust
fn position_x_chaining_mode(self: &Self) -> InteractionChainingMode
```

`PositionXChainingMode`.

Deviation (winui-composition.md): stored only; a manipulation does
not chain to the sources of ancestors.

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

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

### set_position_x_chaining_mode

```rust
fn set_position_x_chaining_mode(self: &Self, value: InteractionChainingMode)
```



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

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

### position_y_chaining_mode

```rust
fn position_y_chaining_mode(self: &Self) -> InteractionChainingMode
```

`PositionYChainingMode` (stored only).

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

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

### set_position_y_chaining_mode

```rust
fn set_position_y_chaining_mode(self: &Self, value: InteractionChainingMode)
```



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

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

### scale_chaining_mode

```rust
fn scale_chaining_mode(self: &Self) -> InteractionChainingMode
```

`ScaleChainingMode` (stored only).

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

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

### set_scale_chaining_mode

```rust
fn set_scale_chaining_mode(self: &Self, value: InteractionChainingMode)
```



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

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

### manipulation_redirection_mode

```rust
fn manipulation_redirection_mode(self: &Self) -> VisualInteractionSourceRedirectionMode
```

`ManipulationRedirectionMode`: the input redirected without
`TryRedirectForManipulation`. The mouse wheel is redirected when it
includes `PointerWheel`; touchpads have no input of their own in
FerroUI (their scrolling arrives as the wheel).

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

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

### set_manipulation_redirection_mode

```rust
fn set_manipulation_redirection_mode(self: &Self, value: VisualInteractionSourceRedirectionMode)
```



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

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

### is_position_x_rails_enabled

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

`IsPositionXRailsEnabled`: a drag that starts close to the X axis
moves along it only.

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

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

### set_is_position_x_rails_enabled

```rust
fn set_is_position_x_rails_enabled(self: &Self, value: bool)
```



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

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

### is_position_y_rails_enabled

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

`IsPositionYRailsEnabled`.

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

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

### set_is_position_y_rails_enabled

```rust
fn set_is_position_y_rails_enabled(self: &Self, value: bool)
```



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

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

### pointer_wheel_config

```rust
fn pointer_wheel_config(self: &Self) -> &Rc<InteractionSourceConfiguration>
```

`PointerWheelConfig`: the axes the redirected wheel drives.

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

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

### delta_position

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

The position change of the last move (`DeltaPosition`), as the
trackers see it.

Deviation (winui-composition.md): the values of the input are
properties of the UI-thread object; expressions cannot reference a
source.

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

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

### delta_scale

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

The scale change of the last input (`DeltaScale`), as a factor.

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

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

### position

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

The position of the current drag since it started (`Position`).

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

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

### position_velocity

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

The velocity of the current drag (`PositionVelocity`).

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

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

### scale

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

The scale of the input (`Scale`).

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

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

### scale_velocity

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

The velocity of the scale of the input (`ScaleVelocity`).

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

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

### try_redirect_for_manipulation

```rust
fn try_redirect_for_manipulation(self: &Self, e: &PointerPressedEventArgs) -> bool
```

`TryRedirectForManipulation(pointerPoint)`, from the pressed event:
the drag of the pressed pointer drives the trackers until it is
released. Returns whether the drag was redirected (not a WinUI
result): not when a drag of this source is in progress, when no axis
is enabled, or when the source has no element.

Deviation (winui-composition.md): any pointer type is redirected,
mouse included.

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

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

### try_redirect_for_manipulation_point

```rust
fn try_redirect_for_manipulation_point(self: &Self, point: &PointerPoint, element: &Ref<InputElement>) -> bool
```

`TryRedirectForManipulation(pointerPoint)` with the element that
captures the pointer. The position of `point` must be in the
coordinates of the top level (`get_current_point(None)`), as the
moves are followed there.

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

## 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`
- `Drop`

## Availability

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