From 05f1bf9481e4fc1cba3b935200c030fb7996e12a Mon Sep 17 00:00:00 2001 From: pythongosssss <125205205+pythongosssss@users.noreply.github.com> Date: Sun, 23 Jun 2024 10:17:11 +0100 Subject: [PATCH] Fix overflow --- web/extensions/core/tooltips.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/web/extensions/core/tooltips.js b/web/extensions/core/tooltips.js index 4b6f21cdc..db5cffe30 100644 --- a/web/extensions/core/tooltips.js +++ b/web/extensions/core/tooltips.js @@ -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); } };