Skip to content

Commit b6b4e99

Browse files
committed
fix: apply xy coord padding
1 parent e66e384 commit b6b4e99

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/components/browser/BrowserWindow.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1423,7 +1423,8 @@ export const BrowserWindow = () => {
14231423
}
14241424

14251425
const iframeRect = iframeElement.getBoundingClientRect();
1426-
const IFRAME_BODY_PADDING = 16;
1426+
const IFRAME_X_PADDING = 16;
1427+
const IFRAME_Y_PADDING = 136;
14271428

14281429
let mappedSimilarElements;
14291430
if (data.similarElements) {
@@ -1432,8 +1433,8 @@ export const BrowserWindow = () => {
14321433
rects: data.similarElements.rects.map(
14331434
(rect) =>
14341435
new DOMRect(
1435-
rect.x + iframeRect.left - IFRAME_BODY_PADDING,
1436-
rect.y + iframeRect.top - IFRAME_BODY_PADDING,
1436+
rect.x + iframeRect.left - IFRAME_X_PADDING,
1437+
rect.y + iframeRect.top - IFRAME_Y_PADDING,
14371438
rect.width,
14381439
rect.height
14391440
)
@@ -1448,8 +1449,8 @@ export const BrowserWindow = () => {
14481449
}
14491450

14501451
const absoluteRect = new DOMRect(
1451-
data.rect.x + iframeRect.left - IFRAME_BODY_PADDING,
1452-
data.rect.y + iframeRect.top - IFRAME_BODY_PADDING,
1452+
data.rect.x + iframeRect.left - IFRAME_X_PADDING,
1453+
data.rect.y + iframeRect.top - IFRAME_Y_PADDING,
14531454
data.rect.width,
14541455
data.rect.height
14551456
);
@@ -1469,8 +1470,8 @@ export const BrowserWindow = () => {
14691470
return {
14701471
element,
14711472
rect: new DOMRect(
1472-
elementRect.x + iframeRect.left - IFRAME_BODY_PADDING,
1473-
elementRect.y + iframeRect.top - IFRAME_BODY_PADDING,
1473+
elementRect.x + iframeRect.left - IFRAME_X_PADDING,
1474+
elementRect.y + iframeRect.top - IFRAME_Y_PADDING,
14741475
elementRect.width,
14751476
elementRect.height
14761477
),

0 commit comments

Comments
 (0)