fix: clamp trim handle end position to timeline boundary#399
fix: clamp trim handle end position to timeline boundary#399muratclk wants to merge 1 commit intosiddharthvaddem:mainfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughClamped timeline span end to never exceed totalMs: Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The right-side trim handle could be dragged past the end of the timeline because clampSpanToBounds did not cap the computed end value at totalMs. This adds Math.min(…, totalMs) so the handle snaps to the timeline edge. Fixes siddharthvaddem#393
a957efb to
a72c3eb
Compare
|
Thanks for this fix ❤️ |
Summary
Fixes #393 — the right-side trim handle could be dragged indefinitely past the end of the timeline.
Root cause:
clampSpanToBoundsinTimelineWrapper.tsxcomputedend = start + durationwithout capping it attotalMs. The sibling functionclampToNeighboursdoes clampendtototalMs, but it's only invoked when there's overlap with neighboring regions — so when no neighbor exists to the right, the handle was unconstrained.Fix: Add
Math.min(start + duration, totalMs)to ensure the end position never exceeds the video duration.Test plan
Summary by CodeRabbit