diff options
| -rw-r--r-- | tools/timeline_editor/index.html | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/tools/timeline_editor/index.html b/tools/timeline_editor/index.html index 22e5239..ea8b454 100644 --- a/tools/timeline_editor/index.html +++ b/tools/timeline_editor/index.html @@ -929,10 +929,37 @@ updateProperties(); }); - // Mouse wheel horizontal scroll + // Mouse wheel diagonal scroll (follows time-ordered sequence cascade) timelineContainer.addEventListener('wheel', (e) => { e.preventDefault(); + + // Horizontal scroll timelineContainer.scrollLeft += e.deltaY; + + // Calculate current time position (left edge of viewport) + const currentScrollLeft = timelineContainer.scrollLeft; + const currentTime = currentScrollLeft / pixelsPerSecond; + + // Find the closest sequence that should be visible at current time + // (the last sequence that starts before or at current time) + let targetSeqIndex = 0; + for (let i = 0; i < sequences.length; i++) { + if (sequences[i].startTime <= currentTime) { + targetSeqIndex = i; + } else { + break; + } + } + + // Smooth vertical scroll to bring target sequence to top of viewport + const targetScrollTop = targetSeqIndex * 80; // 80px per sequence + const currentScrollTop = timelineContainer.scrollTop; + const scrollDiff = targetScrollTop - currentScrollTop; + + // Smooth transition (don't jump instantly) + if (Math.abs(scrollDiff) > 5) { + timelineContainer.scrollTop += scrollDiff * 0.3; + } }, { passive: false }); // Window resize handler |
