fix(map): fermer le tooltip au tap hors département (mobile)
Some checks are pending
Deploy info-canicule / deploy (push) Waiting to run
Some checks are pending
Deploy info-canicule / deploy (push) Waiting to run
Sur mobile, mouseout ne se déclenche pas après un touchstart : le tooltip restait affiché jusqu'au prochain tap sur un département. Ajout d'un listener pointerdown global qui ferme le tooltip dès qu'on tape ailleurs. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
fcfc858299
commit
8638b260ff
1 changed files with 10 additions and 1 deletions
|
|
@ -193,9 +193,18 @@ for (const [code] of entries) {
|
||||||
tooltip.dataset.code = t.getAttribute('data-code');
|
tooltip.dataset.code = t.getAttribute('data-code');
|
||||||
const rect = t.getBoundingClientRect();
|
const rect = t.getBoundingClientRect();
|
||||||
show(t, { clientX: rect.left + rect.width / 2, clientY: rect.top });
|
show(t, { clientX: rect.left + rect.width / 2, clientY: rect.top });
|
||||||
setTimeout(function () { tooltip.dataset.code = ''; }, 3000);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, { passive: false });
|
}, { passive: false });
|
||||||
|
|
||||||
|
// Fermer le tooltip si on tape ailleurs (mobile : pas de mouseout).
|
||||||
|
document.addEventListener('pointerdown', function (e) {
|
||||||
|
const t = e.target;
|
||||||
|
const onPath = t && t.tagName === 'path' && t.getAttribute('data-code');
|
||||||
|
if (!onPath) {
|
||||||
|
tooltip.dataset.code = '';
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue