@@ -192,8 +192,8 @@ export class WebHarness { // implements StateComponent
192192 } ;
193193 }
194194
195- async click ( { x, y } : { x : number , y : number } ) {
196- ( { x, y } = await this . transformCoordinates ( { x, y } ) ) ;
195+ async click ( { x, y } : { x : number , y : number } , options ?: { transform : boolean } ) {
196+ if ( options ?. transform ?? true ) ( { x, y } = await this . transformCoordinates ( { x, y } ) ) ;
197197 // console.log("x:", x);
198198 // console.log("y:", y);
199199 //await this.visualizer.visualizeAction(x, y);
@@ -278,24 +278,24 @@ export class WebHarness { // implements StateComponent
278278 await this . visualizer . showAll ( ) ;
279279 }
280280
281- async rightClick ( { x, y } : { x : number , y : number } ) {
282- ( { x, y } = await this . transformCoordinates ( { x, y } ) ) ;
281+ async rightClick ( { x, y } : { x : number , y : number } , options ?: { transform : boolean } ) {
282+ if ( options ?. transform ?? true ) ( { x, y } = await this . transformCoordinates ( { x, y } ) ) ;
283283 await this . _click ( x , y , { button : "right" } ) ;
284284 await this . waitForStability ( ) ;
285285 }
286286
287- async doubleClick ( { x, y } : { x : number , y : number } ) {
288- ( { x, y } = await this . transformCoordinates ( { x, y } ) ) ;
287+ async doubleClick ( { x, y } : { x : number , y : number } , options ?: { transform : boolean } ) {
288+ if ( options ?. transform ?? true ) ( { x, y } = await this . transformCoordinates ( { x, y } ) ) ;
289289 await this . visualizer . moveVirtualCursor ( x , y ) ;
290290 await this . visualizer . hideAll ( ) ;
291291 await this . page . mouse . dblclick ( x , y ) ;
292292 await this . visualizer . showAll ( ) ;
293293 await this . waitForStability ( ) ;
294294 }
295295
296- async drag ( { x1, y1, x2, y2 } : { x1 : number , y1 : number , x2 : number , y2 : number } ) {
297- ( { x : x1 , y : y1 } = await this . transformCoordinates ( { x : x1 , y : y1 } ) ) ;
298- ( { x : x2 , y : y2 } = await this . transformCoordinates ( { x : x2 , y : y2 } ) ) ;
296+ async drag ( { x1, y1, x2, y2 } : { x1 : number , y1 : number , x2 : number , y2 : number } , options ?: { transform : boolean } ) {
297+ if ( options ?. transform ?? true ) ( { x : x1 , y : y1 } = await this . transformCoordinates ( { x : x1 , y : y1 } ) ) ;
298+ if ( options ?. transform ?? true ) ( { x : x2 , y : y2 } = await this . transformCoordinates ( { x : x2 , y : y2 } ) ) ;
299299
300300 //console.log(`Dragging: (${x1}, ${y1}) -> (${x2}, ${y2})`);
301301
@@ -320,19 +320,19 @@ export class WebHarness { // implements StateComponent
320320 await this . waitForStability ( ) ;
321321 }
322322
323- async clickAndType ( { x, y, content } : { x : number , y : number , content : string } ) {
323+ async clickAndType ( { x, y, content } : { x : number , y : number , content : string } , options ?: { transform : boolean } ) {
324324 // TODO: transforms incorrect for moondream grounding with virtual screen dims (claude) - unsure why
325325 //console.log(`Pre transform: ${x}, ${y}`);
326- ( { x, y } = await this . transformCoordinates ( { x, y } ) ) ;
326+ if ( options ?. transform ?? true ) ( { x, y } = await this . transformCoordinates ( { x, y } ) ) ;
327327 //console.log(`Post transform: ${x}, ${y}`);
328328 await this . visualizer . moveVirtualCursor ( x , y ) ;
329329 this . _click ( x , y ) ;
330330 await this . _type ( content ) ;
331331 await this . waitForStability ( ) ;
332332 }
333333
334- async scroll ( { x, y, deltaX, deltaY } : { x : number , y : number , deltaX : number , deltaY : number } ) {
335- ( { x, y } = await this . transformCoordinates ( { x, y } ) ) ;
334+ async scroll ( { x, y, deltaX, deltaY } : { x : number , y : number , deltaX : number , deltaY : number } , options ?: { transform : boolean } ) {
335+ if ( options ?. transform ?? true ) ( { x, y } = await this . transformCoordinates ( { x, y } ) ) ;
336336 await this . visualizer . moveVirtualCursor ( x , y ) ;
337337 await this . page . mouse . move ( x , y ) ;
338338 await this . page . mouse . wheel ( deltaX , deltaY ) ;
0 commit comments