Skip to content

Commit a44074a

Browse files
committed
fix(android): simplify scroll methods by removing startPoint parameter and enhancing scrolling logic
1 parent 20f6580 commit a44074a

File tree

1 file changed

+4
-35
lines changed

1 file changed

+4
-35
lines changed

packages/android/src/page/index.ts

Lines changed: 4 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -579,59 +579,28 @@ ${Object.keys(size)
579579
return '';
580580
}
581581

582-
async scrollUntilTop(startPoint?: Point): Promise<void> {
583-
if (startPoint) {
584-
const start = { x: startPoint.left, y: startPoint.top };
585-
const end = { x: start.x, y: 0 };
586-
587-
await this.mouseDrag(start, end);
588-
return;
589-
}
590-
582+
async scrollUntilTop(): Promise<void> {
591583
await repeat(defaultScrollUntilTimes, () =>
592584
this.mouseWheel(0, 9999999, defaultFastScrollDuration),
593585
);
594586
await sleep(1000);
595587
}
596588

597-
async scrollUntilBottom(startPoint?: Point): Promise<void> {
598-
if (startPoint) {
599-
const { height } = await this.size();
600-
const start = { x: startPoint.left, y: startPoint.top };
601-
const end = { x: start.x, y: height };
602-
await this.mouseDrag(start, end);
603-
return;
604-
}
605-
589+
async scrollUntilBottom(): Promise<void> {
606590
await repeat(defaultScrollUntilTimes, () =>
607591
this.mouseWheel(0, -9999999, defaultFastScrollDuration),
608592
);
609593
await sleep(1000);
610594
}
611595

612-
async scrollUntilLeft(startPoint?: Point): Promise<void> {
613-
if (startPoint) {
614-
const start = { x: startPoint.left, y: startPoint.top };
615-
const end = { x: 0, y: start.y };
616-
await this.mouseDrag(start, end);
617-
return;
618-
}
619-
596+
async scrollUntilLeft(): Promise<void> {
620597
await repeat(defaultScrollUntilTimes, () =>
621598
this.mouseWheel(9999999, 0, defaultFastScrollDuration),
622599
);
623600
await sleep(1000);
624601
}
625602

626-
async scrollUntilRight(startPoint?: Point): Promise<void> {
627-
if (startPoint) {
628-
const { width } = await this.size();
629-
const start = { x: startPoint.left, y: startPoint.top };
630-
const end = { x: width, y: start.y };
631-
await this.mouseDrag(start, end);
632-
return;
633-
}
634-
603+
async scrollUntilRight(): Promise<void> {
635604
await repeat(defaultScrollUntilTimes, () =>
636605
this.mouseWheel(-9999999, 0, defaultFastScrollDuration),
637606
);

0 commit comments

Comments
 (0)