fix scrolling makes element invisible (#881)
This commit is contained in:
@@ -248,12 +248,16 @@ function isElementVisible(element) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the center point of the element is not in the page, we tag it as an interactable element
|
// if the center point of the element is not in the page, we tag it as an non-interactable element
|
||||||
const center_x = (rect.left + rect.width) / 2;
|
// FIXME: sometimes there could be an overflow element blocking the default scrolling, making Y coordinate be wrong. So we currently only check for X
|
||||||
const center_y = (rect.top + rect.height) / 2;
|
const center_x = (rect.left + rect.width) / 2 + window.scrollX;
|
||||||
if (center_x < 0 || center_y < 0) {
|
if (center_x < 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
// const center_y = (rect.top + rect.height) / 2 + window.scrollY;
|
||||||
|
// if (center_x < 0 || center_y < 0) {
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user