Skip to content

Commit 6f9ae97

Browse files
committed
fix(android): simplify scroll methods by removing startPoint parameter and enhancing scrolling logic
1 parent 8dad93a commit 6f9ae97

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
@@ -529,59 +529,28 @@ ${Object.keys(size)
529529
return '';
530530
}
531531

532-
async scrollUntilTop(startPoint?: Point): Promise<void> {
533-
if (startPoint) {
534-
const start = { x: startPoint.left, y: startPoint.top };
535-
const end = { x: start.x, y: 0 };
536-
537-
await this.mouseDrag(start, end);
538-
return;
539-
}
540-
532+
async scrollUntilTop(): Promise<void> {
541533
await repeat(defaultScrollUntilTimes, () =>
542534
this.mouseWheel(0, 9999999, defaultFastScrollDuration),
543535
);
544536
await sleep(1000);
545537
}
546538

547-
async scrollUntilBottom(startPoint?: Point): Promise<void> {
548-
if (startPoint) {
549-
const { height } = await this.size();
550-
const start = { x: startPoint.left, y: startPoint.top };
551-
const end = { x: start.x, y: height };
552-
await this.mouseDrag(start, end);
553-
return;
554-
}
555-
539+
async scrollUntilBottom(): Promise<void> {
556540
await repeat(defaultScrollUntilTimes, () =>
557541
this.mouseWheel(0, -9999999, defaultFastScrollDuration),
558542
);
559543
await sleep(1000);
560544
}
561545

562-
async scrollUntilLeft(startPoint?: Point): Promise<void> {
563-
if (startPoint) {
564-
const start = { x: startPoint.left, y: startPoint.top };
565-
const end = { x: 0, y: start.y };
566-
await this.mouseDrag(start, end);
567-
return;
568-
}
569-
546+
async scrollUntilLeft(): Promise<void> {
570547
await repeat(defaultScrollUntilTimes, () =>
571548
this.mouseWheel(9999999, 0, defaultFastScrollDuration),
572549
);
573550
await sleep(1000);
574551
}
575552

576-
async scrollUntilRight(startPoint?: Point): Promise<void> {
577-
if (startPoint) {
578-
const { width } = await this.size();
579-
const start = { x: startPoint.left, y: startPoint.top };
580-
const end = { x: width, y: start.y };
581-
await this.mouseDrag(start, end);
582-
return;
583-
}
584-
553+
async scrollUntilRight(): Promise<void> {
585554
await repeat(defaultScrollUntilTimes, () =>
586555
this.mouseWheel(-9999999, 0, defaultFastScrollDuration),
587556
);

0 commit comments

Comments
 (0)