Fix overflow

This commit is contained in:
pythongosssss 2024-06-23 10:17:11 +01:00
parent 1de025a2ff
commit 05f1bf9481

View File

@ -53,7 +53,15 @@ app.registerExtension({
tooltipEl.style.display = "block";
tooltipEl.style.left = app.canvas.mouse[0] + "px";
tooltipEl.style.top = app.canvas.mouse[1] + "px";
}, 300);
const rect = tooltipEl.getBoundingClientRect();
if(rect.right > window.innerWidth) {
tooltipEl.style.left = (app.canvas.mouse[0] - rect.width) + "px";
}
if(rect.top < 0) {
tooltipEl.style.top = (app.canvas.mouse[1] + rect.height) + "px";
}
}, 500);
}
};