tooltip bounds
This commit is contained in:
parent
930e00c9cc
commit
bb2b9cf507
7 changed files with 474 additions and 56 deletions
|
|
@ -222,6 +222,46 @@ export class InputSender {
|
|||
await randomDelay(5, 15);
|
||||
}
|
||||
|
||||
moveMouseInstant(x: number, y: number): void {
|
||||
this.moveMouseRaw(x, y);
|
||||
}
|
||||
|
||||
/** Quick Bézier move — ~10-15ms, 5 steps, no jitter. Fast but not a raw teleport. */
|
||||
async moveMouseFast(x: number, y: number): Promise<void> {
|
||||
const start = this.getCursorPos();
|
||||
const end: Point = { x, y };
|
||||
const dx = end.x - start.x;
|
||||
const dy = end.y - start.y;
|
||||
const distance = Math.sqrt(dx * dx + dy * dy);
|
||||
|
||||
if (distance < 10) {
|
||||
this.moveMouseRaw(x, y);
|
||||
return;
|
||||
}
|
||||
|
||||
const perpX = -dy / distance;
|
||||
const perpY = dx / distance;
|
||||
const spread = distance * 0.15;
|
||||
|
||||
const cp1: Point = {
|
||||
x: start.x + dx * 0.3 + perpX * (Math.random() - 0.5) * spread,
|
||||
y: start.y + dy * 0.3 + perpY * (Math.random() - 0.5) * spread,
|
||||
};
|
||||
const cp2: Point = {
|
||||
x: start.x + dx * 0.7 + perpX * (Math.random() - 0.5) * spread,
|
||||
y: start.y + dy * 0.7 + perpY * (Math.random() - 0.5) * spread,
|
||||
};
|
||||
|
||||
const steps = 5;
|
||||
for (let i = 1; i <= steps; i++) {
|
||||
const t = easeInOutQuad(i / steps);
|
||||
const pt = cubicBezier(t, start, cp1, cp2, end);
|
||||
this.moveMouseRaw(Math.round(pt.x), Math.round(pt.y));
|
||||
await sleep(2);
|
||||
}
|
||||
this.moveMouseRaw(x, y);
|
||||
}
|
||||
|
||||
async leftClick(x: number, y: number): Promise<void> {
|
||||
await this.moveMouse(x, y);
|
||||
await randomDelay(20, 50);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue