Skip to content

Commit

Permalink
fix: correct the target element width / height for higher density scr…
Browse files Browse the repository at this point in the history
…eens

Fixes #71.
  • Loading branch information
menzow authored and Armin Sebastian committed May 14, 2019
1 parent e0f2cb5 commit 22edae2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/solve/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,18 +231,22 @@ async function getElementScreenRect(node, browserBorder) {

x *= scale;
y *= scale;
width *= scale;
height *= scale;

x += data.x + browserBorder.left + window.screenX * scale;
y += data.y + browserBorder.top + window.screenY * scale;

const {os} = await browser.runtime.sendMessage({id: 'getPlatform'});
if (os === 'windows') {
if (['windows','macos'].indexOf(os) > -1) {
const osScale = await getOsScale();
x /= osScale;
y /= osScale;
width /= osScale;
height /= osScale;
}

return {x, y, width: width * scale, height: height * scale};
return {x, y, width: width, height: height};
}

async function getClickPos(node, browserBorder) {
Expand Down

0 comments on commit 22edae2

Please sign in to comment.