fix tooltip breakout calculation position
This commit is contained in:
@@ -10234,20 +10234,19 @@ body.layout-modern>.pagewrapper:not(:has(.index-layout-wrapper)):not(:has(.item-
|
||||
#f0ck-breakout-tooltip[data-flow="up"]::before,
|
||||
#f0ck-breakout-tooltip[data-flow="up-left"]::before {
|
||||
top: 100%;
|
||||
left: 50%;
|
||||
left: var(--arrow-left, 50%);
|
||||
transform: translateX(-50%);
|
||||
border-top-color: #535050;
|
||||
border-bottom-width: 0;
|
||||
}
|
||||
|
||||
#f0ck-breakout-tooltip[data-flow="up-left"]::before {
|
||||
left: 10px;
|
||||
transform: none;
|
||||
/* arrow-left is now computed dynamically; no override needed */
|
||||
}
|
||||
|
||||
#f0ck-breakout-tooltip[data-flow="down"]::before {
|
||||
bottom: 100%;
|
||||
left: 50%;
|
||||
left: var(--arrow-left, 50%);
|
||||
transform: translateX(-50%);
|
||||
border-bottom-color: var(--tooltip-bg, #131212);
|
||||
border-top-width: 0;
|
||||
|
||||
@@ -7714,8 +7714,19 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
}
|
||||
|
||||
// Final clamp to screen
|
||||
breakoutTooltip.style.top = Math.max(5, Math.min(top, window.innerHeight - bRect.height - 5)) + 'px';
|
||||
breakoutTooltip.style.left = Math.max(5, Math.min(left, window.innerWidth - bRect.width - 5)) + 'px';
|
||||
const clampedTop = Math.max(5, Math.min(top, window.innerHeight - bRect.height - 5));
|
||||
const clampedLeft = Math.max(5, Math.min(left, window.innerWidth - bRect.width - 5));
|
||||
breakoutTooltip.style.top = clampedTop + 'px';
|
||||
breakoutTooltip.style.left = clampedLeft + 'px';
|
||||
|
||||
// Point the arrow at the actual target center regardless of clamping
|
||||
if (flow === 'up' || flow === 'up-left' || flow === 'down') {
|
||||
const targetCenterX = rect.left + rect.width / 2;
|
||||
const arrowLeft = Math.round(targetCenterX - clampedLeft);
|
||||
// Keep the arrow within the tooltip bounds (with a small margin)
|
||||
const arrowClamped = Math.max(8, Math.min(arrowLeft, bRect.width - 8));
|
||||
breakoutTooltip.style.setProperty('--arrow-left', arrowClamped + 'px');
|
||||
}
|
||||
};
|
||||
|
||||
const showTooltipFor = (target) => {
|
||||
|
||||
Reference in New Issue
Block a user