Skip to content

Commit 2bb650f

Browse files
fix(computer-use): print scroll distance in pixels in TypeScript
1 parent 2b13dec commit 2bb650f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

templates/typescript/computer-use/tools/computer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,11 +198,11 @@ export class ComputerTool implements BaseAnthropicTool {
198198

199199
if (scrollDirection === 'down' || scrollDirection === 'up') {
200200
const amount = pageDimensions.h * scrollFactor;
201-
console.log(`Scrolling ${amount / pageDimensions.h * 100}% ${scrollDirection}`);
201+
console.log(`Scrolling ${amount.toFixed(2)} pixels ${scrollDirection}`);
202202
await this.page.mouse.wheel(0, scrollDirection === 'down' ? amount : -amount);
203203
} else {
204204
const amount = pageDimensions.w * scrollFactor;
205-
console.log(`Scrolling ${amount / pageDimensions.w * 100}% ${scrollDirection}`);
205+
console.log(`Scrolling ${amount.toFixed(2)} pixels ${scrollDirection}`);
206206
await this.page.mouse.wheel(scrollDirection === 'right' ? amount : -amount, 0);
207207
}
208208

0 commit comments

Comments
 (0)