Skip to content

Commit 705075a

Browse files
author
Sebi Nemeth
committed
fix badge blinking
1 parent f81680f commit 705075a

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

dist/index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,14 +303,18 @@ class LiveTranslatorManager {
303303
position.top = clientRect.top + window.scrollY;
304304
position.left = clientRect.left + window.screenX;
305305
const elemOnTop = document.elementFromPoint(clientRect.left + clientRect.width / 2, clientRect.top + clientRect.height / 2);
306-
isVisible = isVisible || node.parentElement.contains(elemOnTop) || elemOnTop === this._box;
306+
isVisible = isVisible ||
307+
node.parentElement.contains(elemOnTop) ||
308+
this._wrapper.contains(elemOnTop);
307309
}
308310
else {
309311
const clientRect = node.getClientRects()[0];
310312
position.top = clientRect.top + clientRect.height - 10 + window.scrollY;
311313
position.left = clientRect.left + window.screenX;
312314
const elemOnTop = document.elementFromPoint(clientRect.left + clientRect.width / 2, clientRect.top + clientRect.height / 2);
313-
isVisible = isVisible || node.contains(elemOnTop) || elemOnTop === this._box;
315+
isVisible = isVisible ||
316+
node.contains(elemOnTop) ||
317+
this._wrapper.contains(elemOnTop);
314318
}
315319
if (!isVisible) {
316320
continue;

src/index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,13 +359,17 @@ class LiveTranslatorManager {
359359
position.top = clientRect.top + window.scrollY
360360
position.left = clientRect.left + window.screenX
361361
const elemOnTop = document.elementFromPoint(clientRect.left + clientRect.width/2, clientRect.top + clientRect.height/2)
362-
isVisible = isVisible || node.parentElement.contains(elemOnTop) || elemOnTop === this._box
362+
isVisible = isVisible ||
363+
node.parentElement.contains(elemOnTop) ||
364+
this._wrapper.contains(elemOnTop)
363365
} else {
364366
const clientRect = node.getClientRects()[0]
365367
position.top = clientRect.top + clientRect.height - 10 + window.scrollY
366368
position.left = clientRect.left + window.screenX
367369
const elemOnTop = document.elementFromPoint(clientRect.left + clientRect.width/2, clientRect.top + clientRect.height/2)
368-
isVisible = isVisible || node.contains(elemOnTop) || elemOnTop === this._box
370+
isVisible = isVisible ||
371+
node.contains(elemOnTop) ||
372+
this._wrapper.contains(elemOnTop)
369373
}
370374
if (!isVisible) {
371375
continue

0 commit comments

Comments
 (0)