pub struct Touchscreen<OT: ConnectionTransport> { /* private fields */ }Expand description
BiDi Touchscreen implementation for simulating multi-touch gestures.
Touchscreen manages multiple touch points simultaneously, allowing you to simulate
complex multi-touch gestures like pinch-to-zoom, multi-finger swipes, and other
touch interactions.
§Examples
let touchscreen = Arc::new(Touchscreen::new(session));
// Simulate a pinch gesture with two fingers
let touch1 = touchscreen.touch_start(100.0, 200.0, &context, None).await?;
let touch2 = touchscreen.touch_start(300.0, 200.0, &context, None).await?;
// Move fingers closer together
touch1.move_to(150.0, 200.0, &context).await?;
touch2.move_to(250.0, 200.0, &context).await?;
// Release both touches
touch1.end(&context).await?;
touch2.end(&context).await?;Implementations§
Source§impl<OT: ConnectionTransport> Touchscreen<OT>
impl<OT: ConnectionTransport> Touchscreen<OT>
Sourcepub async fn touch_start(
self: &Arc<Self>,
x: f64,
y: f64,
context: &BrowsingContext,
options: Option<TouchMoveOptions>,
) -> Result<TouchHandle<OT>, InputError>
pub async fn touch_start( self: &Arc<Self>, x: f64, y: f64, context: &BrowsingContext, options: Option<TouchMoveOptions>, ) -> Result<TouchHandle<OT>, InputError>
Start a new touch at the given position and return a handle to control it.
Creates a new touch point and immediately performs a touch down event at the specified
coordinates. Returns a TouchHandle that can be used to move or end the touch.
§Arguments
x- X coordinate in pixels where the touch startsy- Y coordinate in pixels where the touch startscontext- The browsing context to perform the touch inoptions- Optional touch movement options
§Returns
A TouchHandle that represents this touch point and can be used to control its movement.
Trait Implementations§
Source§impl<OT: ConnectionTransport> Clone for Touchscreen<OT>
impl<OT: ConnectionTransport> Clone for Touchscreen<OT>
Auto Trait Implementations§
impl<OT> Freeze for Touchscreen<OT>
impl<OT> !RefUnwindSafe for Touchscreen<OT>
impl<OT> Send for Touchscreen<OT>where
OT: Send,
impl<OT> Sync for Touchscreen<OT>where
OT: Send,
impl<OT> Unpin for Touchscreen<OT>
impl<OT> !UnwindSafe for Touchscreen<OT>
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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