merch sizing-guide: clear table on click outside
All checks were successful
/ build (push) Successful in 8s

This commit is contained in:
kritzl 2025-02-13 03:03:11 +01:00
commit 08c4289b73
Signed by: kritzl
SSH key fingerprint: SHA256:5BmINP9VjZWaUk5Z+2CTut1KFhwLtd0ZynMekKbtViM

View file

@ -1146,7 +1146,6 @@
const dimension = cell.dataset.dim; const dimension = cell.dataset.dim;
document.querySelectorAll('td.val:not(.empty)').forEach(match => { document.querySelectorAll('td.val:not(.empty)').forEach(match => {
match.style.backgroundColor = ``
match.dataset.diff = ''; match.dataset.diff = '';
match.classList.remove('highlighted') match.classList.remove('highlighted')
match.classList.remove('currentDimension') match.classList.remove('currentDimension')
@ -1170,6 +1169,7 @@
} }
function selectCellPlus(e) { function selectCellPlus(e) {
e.stopPropagation();
const cell = e.target; const cell = e.target;
const group = cell.parentElement.parentElement; const group = cell.parentElement.parentElement;
const col = cell.dataset.col; const col = cell.dataset.col;
@ -1185,7 +1185,6 @@
}) })
document.querySelectorAll('td.val:not(.empty)').forEach(match => { document.querySelectorAll('td.val:not(.empty)').forEach(match => {
match.style.backgroundColor = ``
match.dataset.diff = ''; match.dataset.diff = '';
match.classList.remove('highlighted') match.classList.remove('highlighted')
match.classList.remove('currentDimension') match.classList.remove('currentDimension')
@ -1238,6 +1237,18 @@
cell.addEventListener('pointerdown', selectCellPlus); cell.addEventListener('pointerdown', selectCellPlus);
}); });
// disable select on click outside value cell
document.addEventListener('pointerdown', e => {
document.querySelectorAll('td.val:not(.empty)').forEach(match => {
match.dataset.diff = '';
match.classList.remove('highlighted')
match.classList.remove('currentDimension')
});
document.querySelectorAll('td.dimension').forEach(match => {
match.classList.remove('currentDimension');
});
});
</script> </script>
</body> </body>