From 22edae2d560b75ef37c8146038320364f2e5bee2 Mon Sep 17 00:00:00 2001 From: Menzo Wijmenga Date: Tue, 14 May 2019 18:36:49 +0200 Subject: [PATCH] fix: correct the target element width / height for higher density screens Fixes #71. --- src/solve/main.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/solve/main.js b/src/solve/main.js index 8d3f7cf..38ccd50 100644 --- a/src/solve/main.js +++ b/src/solve/main.js @@ -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) {