horizontal scrolling where applicable can now be done via vertical mousewheel movement

This commit is contained in:
Disco DeDisco
2026-03-25 00:05:52 -04:00
parent 9698d70164
commit 2f6fc1ff20
4 changed files with 29 additions and 13 deletions

View File

@@ -9,6 +9,15 @@ const initialize = (inputSelector) => {
};
};
const bindPaletteWheel = () => {
document.querySelectorAll('.palette-scroll').forEach(el => {
el.addEventListener('wheel', (e) => {
e.preventDefault();
el.scrollLeft += e.deltaY;
}, { passive: false });
});
};
const bindPaletteForms = () => {
document.querySelectorAll('form[action*="set_palette"]').forEach(form => {
form.addEventListener("submit", async (e) => {

View File

@@ -84,9 +84,10 @@ function initGameKitPage() {
updateFan();
}
// Click on the dialog background (outside .tarot-fan-wrap) closes the modal
// Click on the dark backdrop (the dialog or fan-wrap itself, not on any card child) closes
var fanWrap = dialog.querySelector('.tarot-fan-wrap');
dialog.addEventListener('click', function(e) {
if (!e.target.closest('.tarot-fan-wrap')) closeFan();
if (e.target === dialog || e.target === fanWrap) closeFan();
});
// Arrow key navigation
@@ -95,6 +96,16 @@ function initGameKitPage() {
if (e.key === 'ArrowLeft') navigate(-1);
});
// Mousewheel navigation — throttled so each detent advances one card
var lastWheel = 0;
dialog.addEventListener('wheel', function(e) {
e.preventDefault();
var now = Date.now();
if (now - lastWheel < 150) return;
lastWheel = now;
navigate(e.deltaY > 0 ? 1 : -1);
}, { passive: false });
prevBtn.addEventListener('click', function() { navigate(-1); });
nextBtn.addEventListener('click', function() { navigate(1); });