()
| 373 | } |
| 374 | |
| 375 | function wireZoomButtons() { |
| 376 | if (waveScroll) { |
| 377 | let rafId = null; |
| 378 | const ro = new ResizeObserver(() => { |
| 379 | if (!multitrack || totalDuration <= 0) return; |
| 380 | if (rafId) cancelAnimationFrame(rafId); |
| 381 | rafId = requestAnimationFrame(() => { rafId = null; applyWaveZoom(); }); |
| 382 | }); |
| 383 | ro.observe(waveScroll); |
| 384 | } |
| 385 | if (waveScroll) { |
| 386 | waveScroll.addEventListener("wheel", (e) => { |
| 387 | if (waveScroll.scrollWidth <= waveScroll.clientWidth) return; |
| 388 | if (Math.abs(e.deltaY) > Math.abs(e.deltaX)) { |
| 389 | e.preventDefault(); |
| 390 | waveScroll.scrollLeft += e.deltaY; |
| 391 | } |
| 392 | }, { passive: false }); |
| 393 | waveScroll.addEventListener("scroll", syncRulerScroll, { passive: true }); |
| 394 | } |
| 395 | applyWaveZoom(); |
| 396 | } |
| 397 | |
| 398 | // Keep the mixer column and the waveform area scrolled in lockstep so stem |
| 399 | // controls stay aligned with their lanes when the stack overflows (#159). |
no test coverage detected