Tooltip: Shove cursor over

This commit is contained in:
somebody
2022-10-11 21:34:21 -05:00
parent 56d8138e93
commit 519af3b44b

View File

@@ -5048,8 +5048,17 @@ let load_substitutions;
document.addEventListener("mousemove", function(event) {
if (!tooltipActive) return;
tooltip.style.left = `${event.x}px`;
tooltip.style.top = `${event.y}px`;
let [x, y] = [event.x, event.y];
// X + the tooltip's width is the farthest point right we will display;
// let's account for it. If we will render outside of the window,
// subtract accordingly.
let xOverflow = (x + tooltip.clientWidth) - window.innerWidth;
if (xOverflow > 0) x -= xOverflow;
tooltip.style.left = `${x}px`;
tooltip.style.top = `${y}px`;
});
// Inital scan