pub struct DragSim<T: Clone + 'static> { /* private fields */ }Expand description
Headless driver for one provider’s drag world. Every method takes the
VirtualDom so the underlying signal operations run inside its runtime;
call rerender between actions and markup assertions.
Implementations§
Source§impl<T: Clone + PartialEq + 'static> DragSim<T>
impl<T: Clone + PartialEq + 'static> DragSim<T>
Sourcepub fn place(&self, dom: &VirtualDom, zone: ZoneId, rect: Rect)
pub fn place(&self, dom: &VirtualDom, zone: ZoneId, rect: Rect)
Give a zone its client rect - the headless stand-in for layout.
§Panics
Panics when no zone with this id is registered.
Sourcepub fn window_key(&self) -> Option<WindowKey>
pub fn window_key(&self) -> Option<WindowKey>
The key this sim’s provider joined its world under, when it did.
Sourcepub fn place_in(
&self,
dom: &VirtualDom,
window: WindowKey,
zone: ZoneId,
rect: Rect,
)
pub fn place_in( &self, dom: &VirtualDom, window: WindowKey, zone: ZoneId, rect: Rect, )
Self::place for a zone living in another joined window’s
registry - rect is in that window’s client px.
§Panics
Panics when this sim’s provider joined no world, the window is unknown, or the zone isn’t registered there.
Sourcepub fn pick_up(&mut self, dom: &VirtualDom, payload: T)
pub fn pick_up(&mut self, dom: &VirtualDom, payload: T)
Begin a pointer drag carrying payload, from no particular zone.
Sourcepub fn pick_up_from(
&mut self,
dom: &VirtualDom,
payload: T,
from: Option<ZoneId>,
)
pub fn pick_up_from( &mut self, dom: &VirtualDom, payload: T, from: Option<ZoneId>, )
Begin a pointer drag, reporting from as the source zone
(arrives in DropOutcome::from).
Sourcepub fn move_to(&mut self, dom: &VirtualDom, point: Point)
pub fn move_to(&mut self, dom: &VirtualDom, point: Point)
Move the pointer: updates the tracked position and enters/leaves
zones by hit-testing the placed rects - the same logic the pointer
gesture runs per pointermove.
Sourcepub fn release(&mut self, dom: &VirtualDom) -> Option<ZoneId>
pub fn release(&mut self, dom: &VirtualDom) -> Option<ZoneId>
Release at the current pointer position. Returns the zone that
received the drop, or None when the drag cancelled (no acceptable
zone under the pointer, and none with an edge within the 48px
snap).
Sourcepub fn release_as(
&mut self,
dom: &VirtualDom,
effect: DropEffect,
) -> Option<ZoneId>
pub fn release_as( &mut self, dom: &VirtualDom, effect: DropEffect, ) -> Option<ZoneId>
Self::release with an explicit effect - simulate the Ctrl-held
copy drop with DropEffect::Copy.
Sourcepub fn cancel(&mut self, dom: &VirtualDom)
pub fn cancel(&mut self, dom: &VirtualDom)
Abort the drag, as Escape or a pointer cancel would.
Sourcepub fn completions(&self, dom: &VirtualDom) -> Vec<bool>
pub fn completions(&self, dom: &VirtualDom) -> Vec<bool>
Exactly-once source completion results observed by the simulated
source (true for delivered, false for cancelled).
Sourcepub fn over(&self, dom: &VirtualDom) -> Option<ZoneId>
pub fn over(&self, dom: &VirtualDom) -> Option<ZoneId>
The zone currently hovered.
Sourcepub fn dragging(&self, dom: &VirtualDom) -> bool
pub fn dragging(&self, dom: &VirtualDom) -> bool
Is a drag in flight?
Sourcepub fn payload(&self, dom: &VirtualDom) -> Option<T>
pub fn payload(&self, dom: &VirtualDom) -> Option<T>
The in-flight payload, if any.
Sourcepub fn announcement(&self, dom: &VirtualDom) -> String
pub fn announcement(&self, dom: &VirtualDom) -> String
The latest screen-reader announcement.
Trait Implementations§
impl<T: Clone + 'static> Copy for DragSim<T>
Auto Trait Implementations§
impl<T> !RefUnwindSafe for DragSim<T>
impl<T> !Send for DragSim<T>
impl<T> !Sync for DragSim<T>
impl<T> !UnwindSafe for DragSim<T>
impl<T> Freeze for DragSim<T>
impl<T> Unpin for DragSim<T>where
T: Unpin,
impl<T> UnsafeUnpin for DragSim<T>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> InitializeFromFunction<T> for T
impl<T> InitializeFromFunction<T> for T
Source§fn initialize_from_function(f: fn() -> T) -> T
fn initialize_from_function(f: fn() -> T) -> T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more