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.
Members
createcreate_for_elementelementsourcecompositorposition_x_source_modeset_position_x_source_modeposition_y_source_modeset_position_y_source_modescale_source_modeset_scale_source_modeposition_x_chaining_modeset_position_x_chaining_modeposition_y_chaining_modeset_position_y_chaining_modescale_chaining_modeset_scale_chaining_modemanipulation_redirection_modeset_manipulation_redirection_modeis_position_x_rails_enabledset_is_position_x_rails_enabledis_position_y_rails_enabledset_is_position_y_rails_enabledpointer_wheel_configdelta_positiondelta_scalepositionposition_velocityscalescale_velocitytry_redirect_for_manipulationtry_redirect_for_manipulation_point
create
fn create(source: &Rc<CompositionVisual>) -> Rc<VisualInteractionSource>
VisualInteractionSource.Create(source): a source for the input of
the element of 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.
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
fn source(self: &Self) -> &Rc<CompositionVisual>
The visual the source was created for (Source).
compositor
fn compositor(self: &Self) -> &Rc<Compositor>
The compositor of the visual.
position_x_source_mode
fn position_x_source_mode(self: &Self) -> InteractionSourceMode
PositionXSourceMode.
set_position_x_source_mode
fn set_position_x_source_mode(self: &Self, value: InteractionSourceMode)
position_y_source_mode
fn position_y_source_mode(self: &Self) -> InteractionSourceMode
PositionYSourceMode.
set_position_y_source_mode
fn set_position_y_source_mode(self: &Self, value: InteractionSourceMode)
scale_source_mode
fn scale_source_mode(self: &Self) -> InteractionSourceMode
ScaleSourceMode. Only the Ctrl + mouse wheel scales: pinch input
is not redirected.
set_scale_source_mode
fn set_scale_source_mode(self: &Self, value: InteractionSourceMode)
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.
set_position_x_chaining_mode
fn set_position_x_chaining_mode(self: &Self, value: InteractionChainingMode)
position_y_chaining_mode
fn position_y_chaining_mode(self: &Self) -> InteractionChainingMode
PositionYChainingMode (stored only).
set_position_y_chaining_mode
fn set_position_y_chaining_mode(self: &Self, value: InteractionChainingMode)
scale_chaining_mode
fn scale_chaining_mode(self: &Self) -> InteractionChainingMode
ScaleChainingMode (stored only).
set_scale_chaining_mode
fn set_scale_chaining_mode(self: &Self, value: InteractionChainingMode)
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).
set_manipulation_redirection_mode
fn set_manipulation_redirection_mode(self: &Self, value: VisualInteractionSourceRedirectionMode)
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.
set_is_position_x_rails_enabled
fn set_is_position_x_rails_enabled(self: &Self, value: bool)
is_position_y_rails_enabled
fn is_position_y_rails_enabled(self: &Self) -> bool
IsPositionYRailsEnabled.
set_is_position_y_rails_enabled
fn set_is_position_y_rails_enabled(self: &Self, value: bool)
pointer_wheel_config
fn pointer_wheel_config(self: &Self) -> &Rc<InteractionSourceConfiguration>
PointerWheelConfig: the axes the redirected wheel drives.
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.
delta_scale
fn delta_scale(self: &Self) -> f32
The scale change of the last input (DeltaScale), as a factor.
position
fn position(self: &Self) -> Vector3
The position of the current drag since it started (Position).
position_velocity
fn position_velocity(self: &Self) -> Vector3
The velocity of the current drag (PositionVelocity).
scale
fn scale(self: &Self) -> f32
The scale of the input (Scale).
scale_velocity
fn scale_velocity(self: &Self) -> f32
The velocity of the scale of the input (ScaleVelocity).
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.
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.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeClassDefaultsBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>AnyErasedDestructorIntoEitherDrop
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.