FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    VisualInteractionSource

    struct · ferroui-base · v0.5.0

    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

    Members

    create

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

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

    Source

    create_for_element

    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

    element

    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

    source

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

    The visual the source was created for (Source).

    Source

    compositor

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

    The compositor of the visual.

    Source

    position_x_source_mode

    fn position_x_source_mode(self: &Self) -> InteractionSourceMode
    

    PositionXSourceMode.

    Source

    set_position_x_source_mode

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

    Source

    position_y_source_mode

    fn position_y_source_mode(self: &Self) -> InteractionSourceMode
    

    PositionYSourceMode.

    Source

    set_position_y_source_mode

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

    Source

    scale_source_mode

    fn scale_source_mode(self: &Self) -> InteractionSourceMode
    

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

    Source

    set_scale_source_mode

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

    Source

    position_x_chaining_mode

    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

    set_position_x_chaining_mode

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

    Source

    position_y_chaining_mode

    fn position_y_chaining_mode(self: &Self) -> InteractionChainingMode
    

    PositionYChainingMode (stored only).

    Source

    set_position_y_chaining_mode

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

    Source

    scale_chaining_mode

    fn scale_chaining_mode(self: &Self) -> InteractionChainingMode
    

    ScaleChainingMode (stored only).

    Source

    set_scale_chaining_mode

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

    Source

    manipulation_redirection_mode

    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

    set_manipulation_redirection_mode

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

    Source

    is_position_x_rails_enabled

    fn is_position_x_rails_enabled(self: &Self) -> bool
    

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

    Source

    set_is_position_x_rails_enabled

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

    Source

    is_position_y_rails_enabled

    fn is_position_y_rails_enabled(self: &Self) -> bool
    

    IsPositionYRailsEnabled.

    Source

    set_is_position_y_rails_enabled

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

    Source

    pointer_wheel_config

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

    PointerWheelConfig: the axes the redirected wheel drives.

    Source

    delta_position

    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

    delta_scale

    fn delta_scale(self: &Self) -> f32
    

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

    Source

    position

    fn position(self: &Self) -> Vector3
    

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

    Source

    position_velocity

    fn position_velocity(self: &Self) -> Vector3
    

    The velocity of the current drag (PositionVelocity).

    Source

    scale

    fn scale(self: &Self) -> f32
    

    The scale of the input (Scale).

    Source

    scale_velocity

    fn scale_velocity(self: &Self) -> f32
    

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

    Source

    try_redirect_for_manipulation

    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

    try_redirect_for_manipulation_point

    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

    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
    • Drop

    Availability

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