Improve trim and drag of audio/video clips

This commit is contained in:
Skyler Lehmkuhl
2025-12-03 06:07:39 -05:00
parent ef1956e8e3
commit 346baac840
4 changed files with 127 additions and 65 deletions
@@ -203,7 +203,7 @@ impl Action for TrimClipInstancesAction {
// Clamp to max allowed
let actual_extend = desired_extend.min(max_extend);
let clamped_trim_start = old_trim - actual_extend;
let clamped_timeline_start = old_timeline - actual_extend;
let clamped_timeline_start = (old_timeline - actual_extend).max(0.0);
clamped_new = TrimData::left(clamped_trim_start, clamped_timeline_start);
}
@@ -440,7 +440,10 @@ impl Document {
) -> Option<f64> {
let layer = self.get_layer(layer_id)?;
// Vector/MIDI layers don't need adjustment
// Clamp to timeline start (can't go before 0)
let desired_start = desired_start.max(0.0);
// Vector/MIDI layers don't need overlap adjustment, but still respect timeline start
if !matches!(layer, AnyLayer::Audio(_) | AnyLayer::Video(_)) {
return Some(desired_start);
}