diff --git a/config.php b/config.php index 616d4cb..febdef0 100644 --- a/config.php +++ b/config.php @@ -1,7 +1,7 @@ 2; + const canRight = bar.scrollLeft + bar.clientWidth < bar.scrollWidth - 2; + barRow.classList.toggle('fade-left', canLeft && !canRight); + barRow.classList.toggle('fade-right', !canLeft && canRight); + barRow.classList.toggle('fade-both', canLeft && canRight); + // Right-side fade overlay is anchored to the parent's right edge; + // the actual bar ends before the toolbar toggles. Compute the + // distance so the gradient lines up with the bar's right edge. + const rowRect = barRow.getBoundingClientRect(); + const barRect = bar.getBoundingClientRect(); + const rightInset = Math.max(0, rowRect.right - barRect.right); + barRow.style.setProperty('--bucket-row-right-inset', rightInset + 'px'); +} +if (bar) { + bar.addEventListener('wheel', (e) => { + if (e.deltaY === 0) return; + if (bar.scrollWidth <= bar.clientWidth) return; + e.preventDefault(); + bar.scrollLeft += e.deltaY; + }, { passive: false }); + bar.addEventListener('scroll', updateBucketBarFades, { passive: true }); + window.addEventListener('resize', updateBucketBarFades); + new MutationObserver(updateBucketBarFades).observe(bar, { childList: true, subtree: false }); + updateBucketBarFades(); +} + /** Switch the active bucket without going through the click path — * used by the number-key hotkeys (and any other code that wants to * activate a bucket programmatically without triggering the super-