Skip to content

Commit 65b4e09

Browse files
committed
bugfix
1 parent 3d03025 commit 65b4e09

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

dataBrowser/dataBrowser.js.temp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,20 @@ function initPanelZoom() {
5656
document.body.appendChild(overlay);
5757

5858
document.querySelectorAll('.panel img').forEach((img) => {
59-
img.addEventListener('mouseenter', () => {
59+
// Restart the dwell countdown on every movement so the overlay only opens
60+
// after the cursor has been still for 800ms over the plot image, not merely
61+
// present within its bounds.
62+
const scheduleZoom = () => {
63+
if (overlay.classList.contains('open')) return; // already shown; leave it
6064
if (img.src.includes('placeholder')) return;
65+
clearTimeout(zoomTimer);
6166
zoomTimer = setTimeout(() => {
6267
big.src = img.src;
6368
overlay.classList.add('open');
6469
}, 800);
65-
});
70+
};
71+
img.addEventListener('mouseenter', scheduleZoom);
72+
img.addEventListener('mousemove', scheduleZoom);
6673
img.addEventListener('mouseleave', () => {
6774
clearTimeout(zoomTimer);
6875
overlay.classList.remove('open');

0 commit comments

Comments
 (0)