FilmCraft: An open-source, nonlinear video editor written by scratch in pure Rust
Merge pull request #1225 from haranishi/fix/1191-locked-track-feedback
Brandon Thomas13355a77a990
diff --cc crates/ui-egui/src/panels/timeline.rsindex 425f89980,e5836ffbd..edb5646e4--- a/crates/ui-egui/src/panels/timeline.rs+++ b/crates/ui-egui/src/panels/timeline.rs@@@ -578,29 -572,25 +578,37 @@@ pub fn show(app: &mut FilmcraftApp, uiSome(Drag::Transition { id, start, duration, .. }) if *id == trn.id => (*start, *start + *duration),_ => (trn.start, trn.end()),};- let x0 = layout.x_of(start);- let x1 = layout.x_of(end);- let tr_rect = Rect::from_min_max(pos2(x0, r.rect.min.y + 17.0), pos2(x1, r.rect.max.y - 1.0));- let selected = app.session.state.transition_selection.contains(&trn.id);- draw_transition(&p, tr_rect, trn, selected, &t);- app.auto.add(&format!("timeline.transition.{}", trn.id.0), tr_rect, &trn.effect.effect);- // its ends, for dragging the duration (the same zones as the hit test)- let zone = super::timeline_hit::EDGE_PX.min(tr_rect.width() / 3.0);- app.auto.add(&format!("timeline.transition.{}.in", trn.id.0), Rect::from_min_max(tr_rect.min, pos2(x0 + zone, tr_rect.max.y)), "start");- app.auto.add(&format!("timeline.transition.{}.out", trn.id.0), Rect::from_min_max(pos2(x1 - zone, tr_rect.min.y), tr_rect.max), "end");+ // (start, end, is the copy's ghost)+ let show: Vec<(Tick, Tick, bool)> = match (carried, copying) {+ (Some((s, e, dest)), false) if dest == r.track => vec![(s, e, false)],+ (Some((s, e, dest)), true) if dest == r.track => vec![(start, end, false), (s, e, true)],+ (Some(_), false) => Vec::new(), // drawn on its destination row+ _ => vec![(start, end, false)], // at home: not carried, or a copy's original+ };+ for (start, end, ghost) in show {+ let x0 = layout.x_of(start);+ let x1 = layout.x_of(end);+ let tr_rect = Rect::from_min_max(pos2(x0, r.rect.min.y + 17.0), pos2(x1, r.rect.max.y - 1.0));+ let selected = app.session.state.transition_selection.contains(&trn.id);+ draw_transition(&p, tr_rect, trn, ghost || selected, &t);+ let suffix = if ghost { ".copy" } else { "" };+ app.auto.add(&format!("timeline.transition.{}{}", trn.id.0, suffix), tr_rect, &trn.effect.effect);+ // its ends, for dragging the duration (the same zones as the hit test)+ let zone = super::timeline_hit::EDGE_PX.min(tr_rect.width() / 3.0);+ if !ghost {+ app.auto.add(&format!("timeline.transition.{}.in", trn.id.0), Rect::from_min_max(tr_rect.min, pos2(x0 + zone, tr_rect.max.y)), "start");+ app.auto.add(&format!("timeline.transition.{}.out", trn.id.0), Rect::from_min_max(pos2(x1 - zone, tr_rect.min.y), tr_rect.max), "end");+ }+ }}+ if tr.locked {+ let color = Color32::from_rgba_unmultiplied(t.text.r(), t.text.g(), t.text.b(), 64);+ let mut x = content.min.x - row.height();+ while x < content.max.x {+ p.line_segment([pos2(x, row.max.y), pos2(x + row.height(), row.min.y)], Stroke::new(1.0, color));+ x += 8.0;+ }+ }}// An existing clip dragged past the outer row previews its new destination (#1187).