tooltips now fully styled, appearing above applet container to avoid clipping issues; new methods added to apps.lyric.models.Token

This commit is contained in:
Disco DeDisco
2026-03-09 23:48:20 -04:00
parent 645b265c80
commit d2861077a4
7 changed files with 143 additions and 64 deletions

View File

@@ -0,0 +1,24 @@
function initGameKitTooltips() {
const portal = document.getElementById('id_tooltip_portal');
if (!portal) return;
document.querySelectorAll('#id_game_kit .token').forEach(token => {
const tooltip = token.querySelector('.token-tooltip');
if (!tooltip) return;
token.addEventListener('mouseenter', () => {
const rect = token.getBoundingClientRect();
portal.innerHTML = tooltip.innerHTML;
portal.style.left = Math.round(rect.left + rect.width / 2) + 'px';
portal.style.top = Math.round(rect.top) + 'px';
portal.style.transform = 'translate(-50%, calc(-100% - 0.5rem))';
portal.classList.add('active');
});
token.addEventListener('mouseleave', () => {
portal.classList.remove('active');
});
});
}
document.addEventListener('DOMContentLoaded', initGameKitTooltips);