mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 10:31:47 +00:00
fix(in-app-menu): fix in-app-menu tooltip position
This commit is contained in:
@ -61,7 +61,18 @@ export const createPanel = (
|
||||
if (item.toolTip) {
|
||||
const menuTooltip = document.createElement('menu-item-tooltip');
|
||||
menuTooltip.append(item.toolTip);
|
||||
menu.append(menuTooltip);
|
||||
|
||||
menu.addEventListener('mouseenter', () => {
|
||||
const rect = menu.getBoundingClientRect();
|
||||
menuTooltip.style.setProperty('max-width', `${rect.width - 8}px`);
|
||||
menuTooltip.style.setProperty('--x', `${rect.left}px`);
|
||||
menuTooltip.style.setProperty('--y', `${rect.top + rect.height}px`);
|
||||
menuTooltip.classList.add('show');
|
||||
});
|
||||
menu.addEventListener('mouseleave', () => {
|
||||
menuTooltip.classList.remove('show');
|
||||
});
|
||||
parent.append(menuTooltip);
|
||||
}
|
||||
|
||||
menu.addEventListener('click', async () => {
|
||||
|
||||
@ -152,10 +152,10 @@ menu-item-badge {
|
||||
}
|
||||
|
||||
menu-item-tooltip {
|
||||
position: absolute;
|
||||
position: fixed;
|
||||
|
||||
left: 0;
|
||||
top: calc(100% + 4px);
|
||||
left: var(--x, 0);
|
||||
top: var(--y, 0);
|
||||
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
@ -176,9 +176,9 @@ menu-item-tooltip {
|
||||
scale: 0.9;
|
||||
|
||||
transform-origin: 50% 0;
|
||||
transition: all 0.225s ease-out;
|
||||
transition: opacity 0.225s ease-out, scale 0.225s ease-out;
|
||||
}
|
||||
menu-item:hover > menu-item-tooltip {
|
||||
menu-item-tooltip.show {
|
||||
opacity: 1;
|
||||
scale: 1.0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user