Small delay on hint

This commit is contained in:
N Pex 2023-03-29 08:19:42 +00:00
parent 385ab8486e
commit 4c06796c02
2 changed files with 25 additions and 11 deletions

View file

@ -548,24 +548,23 @@ class Util {
isChildVisible(parentNode, childNode) {
const rect1 = parentNode.getBoundingClientRect();
const rect2 = childNode.getBoundingClientRect();
var overlap = !(rect1.right < rect2.left ||
rect1.left > rect2.right ||
rect1.bottom < rect2.top ||
rect1.top > rect2.bottom)
var overlap = !(rect1.right <= rect2.left ||
rect1.left >= rect2.right ||
rect1.bottom <= rect2.top ||
rect1.top >= rect2.bottom)
return overlap;
}
findOneVisibleElement(parentNode) {
let start = 0;
let end = parentNode.children.length - 1;
let top = parentNode.scrollTop;
while (start <= end) {
let middle = Math.floor((start + end) / 2);
let childNode = parentNode.children[middle];
if (this.isChildVisible(parentNode, childNode)) {
// found the key
return middle;
} else if (childNode.offsetTop < top) {
} else if (childNode.getBoundingClientRect().top <= parentNode.getBoundingClientRect().top) {
// continue searching to the right
start = middle + 1;
} else {