Skip to content

Commit a66b87a

Browse files
committed
fix: align prediction marker on scaled displays
1 parent 7986f5a commit a66b87a

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

apps/ui-tars/src/main/window/ScreenMarker.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ class ScreenMarker {
206206
});
207207

208208
const { scaleFactor = 1 } = screenshotContext;
209+
const { bounds } = screen.getPrimaryDisplay();
209210

210211
// loop predictions
211212
for (let i = 0; i < overlays.length; i++) {
@@ -229,9 +230,9 @@ class ScreenMarker {
229230
webPreferences: { nodeIntegration: true, contextIsolation: false },
230231
...(overlay.xPos &&
231232
overlay.yPos && {
232-
// logical pixels
233-
x: (overlay.xPos + overlay.offsetX) * scaleFactor,
234-
y: (overlay.yPos + overlay.offsetY) * scaleFactor,
233+
// Convert screenshot pixels into Electron's global logical pixels.
234+
x: bounds.x + overlay.xPos / scaleFactor + overlay.offsetX,
235+
y: bounds.y + overlay.yPos / scaleFactor + overlay.offsetY,
235236
}),
236237
});
237238

0 commit comments

Comments
 (0)