pub struct VisualInteractionSource { /* private fields */ }Expand description
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.
Implementations§
Source§impl VisualInteractionSource
impl VisualInteractionSource
Sourcepub fn create(source: &Rc<CompositionVisual>) -> Rc<VisualInteractionSource>
pub fn create(source: &Rc<CompositionVisual>) -> Rc<VisualInteractionSource>
VisualInteractionSource.Create(source): a source for the input of
the element of source.
Sourcepub fn create_for_element(
source: &Rc<CompositionVisual>,
element: &Ref<InputElement>,
) -> Rc<VisualInteractionSource>
pub 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.
Sourcepub fn element(&self) -> Option<Ref<InputElement>>
pub fn element(&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.
Sourcepub fn source(&self) -> &Rc<CompositionVisual>
pub fn source(&self) -> &Rc<CompositionVisual>
The visual the source was created for (Source).
Sourcepub fn compositor(&self) -> &Rc<Compositor>
pub fn compositor(&self) -> &Rc<Compositor>
The compositor of the visual.
Sourcepub fn position_x_source_mode(&self) -> InteractionSourceMode
pub fn position_x_source_mode(&self) -> InteractionSourceMode
PositionXSourceMode.
pub fn set_position_x_source_mode(&self, value: InteractionSourceMode)
Sourcepub fn position_y_source_mode(&self) -> InteractionSourceMode
pub fn position_y_source_mode(&self) -> InteractionSourceMode
PositionYSourceMode.
pub fn set_position_y_source_mode(&self, value: InteractionSourceMode)
Sourcepub fn scale_source_mode(&self) -> InteractionSourceMode
pub fn scale_source_mode(&self) -> InteractionSourceMode
ScaleSourceMode. Only the Ctrl + mouse wheel scales: pinch input
is not redirected.
pub fn set_scale_source_mode(&self, value: InteractionSourceMode)
Sourcepub fn position_x_chaining_mode(&self) -> InteractionChainingMode
pub fn position_x_chaining_mode(&self) -> InteractionChainingMode
PositionXChainingMode.
Deviation (winui-composition.md): stored only; a manipulation does not chain to the sources of ancestors.
pub fn set_position_x_chaining_mode(&self, value: InteractionChainingMode)
Sourcepub fn position_y_chaining_mode(&self) -> InteractionChainingMode
pub fn position_y_chaining_mode(&self) -> InteractionChainingMode
PositionYChainingMode (stored only).
pub fn set_position_y_chaining_mode(&self, value: InteractionChainingMode)
Sourcepub fn scale_chaining_mode(&self) -> InteractionChainingMode
pub fn scale_chaining_mode(&self) -> InteractionChainingMode
ScaleChainingMode (stored only).
pub fn set_scale_chaining_mode(&self, value: InteractionChainingMode)
Sourcepub fn manipulation_redirection_mode(
&self,
) -> VisualInteractionSourceRedirectionMode
pub fn manipulation_redirection_mode( &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).
pub fn set_manipulation_redirection_mode( &self, value: VisualInteractionSourceRedirectionMode, )
Sourcepub fn is_position_x_rails_enabled(&self) -> bool
pub fn is_position_x_rails_enabled(&self) -> bool
IsPositionXRailsEnabled: a drag that starts close to the X axis
moves along it only.
pub fn set_is_position_x_rails_enabled(&self, value: bool)
Sourcepub fn is_position_y_rails_enabled(&self) -> bool
pub fn is_position_y_rails_enabled(&self) -> bool
IsPositionYRailsEnabled.
pub fn set_is_position_y_rails_enabled(&self, value: bool)
Sourcepub fn pointer_wheel_config(&self) -> &Rc<InteractionSourceConfiguration>
pub fn pointer_wheel_config(&self) -> &Rc<InteractionSourceConfiguration>
PointerWheelConfig: the axes the redirected wheel drives.
Sourcepub fn delta_position(&self) -> Vector3
pub fn delta_position(&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.
Sourcepub fn delta_scale(&self) -> f32
pub fn delta_scale(&self) -> f32
The scale change of the last input (DeltaScale), as a factor.
Sourcepub fn position(&self) -> Vector3
pub fn position(&self) -> Vector3
The position of the current drag since it started (Position).
Sourcepub fn position_velocity(&self) -> Vector3
pub fn position_velocity(&self) -> Vector3
The velocity of the current drag (PositionVelocity).
Sourcepub fn scale_velocity(&self) -> f32
pub fn scale_velocity(&self) -> f32
The velocity of the scale of the input (ScaleVelocity).
Sourcepub fn try_redirect_for_manipulation(&self, e: &PointerPressedEventArgs) -> bool
pub fn try_redirect_for_manipulation(&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.
Sourcepub fn try_redirect_for_manipulation_point(
&self,
point: &PointerPoint,
element: &Ref<InputElement>,
) -> bool
pub fn try_redirect_for_manipulation_point( &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§
Source§impl Drop for VisualInteractionSource
impl Drop for VisualInteractionSource
Auto Trait Implementations§
impl !Freeze for VisualInteractionSource
impl !RefUnwindSafe for VisualInteractionSource
impl !Send for VisualInteractionSource
impl !Sync for VisualInteractionSource
impl !UnwindSafe for VisualInteractionSource
impl Unpin for VisualInteractionSource
impl UnsafeUnpin for VisualInteractionSource
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
affects_render, metadata
overrides). Read more