Merge pull request #3007 from vladmandic/BinaryQuantumSoul-patch-2

Move tooltip left when on the right side of the window (prevents potential hovering)
This commit is contained in:
Vladimir Mandic
2024-03-26 16:58:07 -04:00
committed by GitHub
2 changed files with 6 additions and 0 deletions
+1
View File
@@ -15,6 +15,7 @@
.tooltip { display: block; position: fixed; top: 1em; right: 1em; padding: 0.5em; background: var(--input-background-fill); color: var(--body-text-color); border: 1pt solid var(--button-primary-border-color);
width: 22em; min-height: 1.3em; font-size: 0.8em; transition: opacity 0.2s ease-in; pointer-events: none; opacity: 0; z-index: 999; }
.tooltip-show { opacity: 0.9; }
.tooltip-left { right: unset; left: 1em; }
.toolbutton-selected { background: var(--background-fill-primary) !important; }
/* live preview */
+5
View File
@@ -21,6 +21,11 @@ async function tooltipShow(e) {
if (e.target.dataset.hint) {
localeData.el.classList.add('tooltip-show');
localeData.el.innerHTML = `<b>${e.target.textContent}</b><br>${e.target.dataset.hint}`;
if (e.clientX > window.innerWidth / 2) {
localeData.el.classList.add('tooltip-left');
} else {
localeData.el.classList.remove('tooltip-left');
}
}
}