pub struct MouseEngine {
pub min_speed: f64,
pub max_speed: f64,
pub steps_per_second: u32,
/* private fields */
}Expand description
A smooth pointer-motion generator.
The engine uses a bounded number of samples and small per-movement variations. This keeps the event stream realistic without turning a click into hundreds of unnecessary CDP round trips.
Fields§
§min_speed: f64§max_speed: f64§steps_per_second: u32Implementations§
Source§impl MouseEngine
impl MouseEngine
pub fn new() -> Self
Sourcepub fn generate_path(&self, start: Point, end: Point) -> Vec<Point>
pub fn generate_path(&self, start: Point, end: Point) -> Vec<Point>
Generate a bounded list of points along a smooth path.
Sourcepub fn move_delay(&self, _start: Point, _end: Point) -> Duration
pub fn move_delay(&self, _start: Point, _end: Point) -> Duration
Calculate the cadence between consecutive pointer samples.
Samples are evenly timed so the eased spatial curve produces actual acceleration and deceleration instead of having its timing cancelled out by distance-proportional sleeps.
Sourcepub fn click_delay(&self) -> Duration
pub fn click_delay(&self) -> Duration
Return a short, varied mouse-down dwell before release.
Sourcepub fn generate_click_events(&self, point: Point) -> Vec<MouseEvent>
pub fn generate_click_events(&self, point: Point) -> Vec<MouseEvent>
Generate the press/release events after the pointer reaches a target.
pub fn generate_double_click_events(&self, point: Point) -> Vec<MouseEvent>
pub fn generate_drag_events(&self, start: Point, end: Point) -> Vec<MouseEvent>
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for MouseEngine
impl RefUnwindSafe for MouseEngine
impl Send for MouseEngine
impl Sync for MouseEngine
impl Unpin for MouseEngine
impl UnsafeUnpin for MouseEngine
impl UnwindSafe for MouseEngine
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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