fix: last commit
This commit is contained in:
parent
2462f1e8ee
commit
d89f5f45ee
|
|
@ -472,11 +472,22 @@
|
|||
// ── Status bar hover tooltip ──────────────────────────────────────
|
||||
const statusBar = document.getElementById('status-bar');
|
||||
const statusTooltip = document.getElementById('status-tooltip');
|
||||
let _hoveredSeg = null;
|
||||
let _statusMouseX = null;
|
||||
|
||||
function segAtX(x) {
|
||||
if (x == null) return null;
|
||||
const barRect = statusBar.getBoundingClientRect();
|
||||
const absX = barRect.left + x;
|
||||
for (const seg of statusBar.querySelectorAll('[data-run]')) {
|
||||
const r = seg.getBoundingClientRect();
|
||||
if (absX >= r.left && absX <= r.right) return seg;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function updateStatusTooltip() {
|
||||
const seg = _hoveredSeg;
|
||||
if (!seg || !seg.parentElement) { statusTooltip.classList.add('hidden'); _hoveredSeg = null; return; }
|
||||
const seg = segAtX(_statusMouseX);
|
||||
if (!seg) { statusTooltip.classList.add('hidden'); return; }
|
||||
|
||||
const up = parseInt(seg.dataset.up || '0');
|
||||
const down = parseInt(seg.dataset.down || '0');
|
||||
|
|
@ -525,14 +536,13 @@
|
|||
}
|
||||
|
||||
statusBar.addEventListener('mousemove', (e) => {
|
||||
const seg = e.target.closest('[data-run]');
|
||||
if (!seg) { statusTooltip.classList.add('hidden'); _hoveredSeg = null; return; }
|
||||
_hoveredSeg = seg;
|
||||
const barRect = statusBar.getBoundingClientRect();
|
||||
_statusMouseX = e.clientX - barRect.left;
|
||||
updateStatusTooltip();
|
||||
});
|
||||
|
||||
statusBar.addEventListener('mouseleave', () => {
|
||||
_hoveredSeg = null;
|
||||
_statusMouseX = null;
|
||||
statusTooltip.classList.add('hidden');
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue