The selection moves, ghosts, copies and pastes as one set
Browse files at this commit- feat
- the selection moves, ghosts, copies and pastes as one set
12 changed files +662 -85
- crates/app/src/library_meta.rs +20 -13
- crates/app/src/main.rs +14 -7
- crates/app/src/player/actions.rs +2 -2
- crates/app/src/player/library.rs +3 -3
- crates/app/src/player/timeline_edit.rs +187 -37
- crates/app/src/player/transport.rs +1 -1
- crates/app/src/render.rs +4 -4
- crates/app/src/tests/editing.rs +275 -6
- crates/app/src/ui/bench_stance.rs +2 -0
- crates/app/src/ui/timeline.rs +9 -5
- crates/engine/src/playback.rs +26 -0
- crates/engine/src/project.rs +119 -7
crates/app/src/library_meta.rsmodified+20 -13
| @@ -9,19 +9,26 @@ use crate::*; | |||
| 9 | /// **a different file** -- the next one along -- over the range it was copied | 9 | /// **a different file** -- the next one along -- over the range it was copied |
| 10 | /// from. | 10 | /// from. |
| 11 | /// | 11 | /// |
| 12 | -/// The clip's own file gone means there is nothing to paste: `None`, and the | 12 | +/// An entry whose own file is gone drops out of the clipboard rather than |
| 13 | -/// next paste says the clipboard is empty rather than putting some other take | 13 | +/// pasting some other take down in its place; a set with even one such |
| 14 | -/// down. Every index past it moves down by one, exactly as the lanes' clips do. | 14 | +/// member is trimmed, not emptied whole, the way a lane keeps every clip a |
| 15 | -pub(crate) fn clipboard_after_remove(clip: Option<Clip>, removed: usize) -> Option<Clip> { | 15 | +/// removal did not touch. Every index past `removed` moves down by one, |
| 16 | - let mut clip = clip?; | 16 | +/// exactly as the lanes' clips do. |
| 17 | - match clip.source.cmp(&removed) { | 17 | +pub(crate) fn clipboard_after_remove( |
| 18 | - std::cmp::Ordering::Equal => None, | 18 | + clipboard: Vec<(Lane, Clip)>, |
| 19 | - std::cmp::Ordering::Greater => { | 19 | + removed: usize, |
| 20 | - clip.source -= 1; | 20 | +) -> Vec<(Lane, Clip)> { |
| 21 | - Some(clip) | 21 | + clipboard |
| 22 | - } | 22 | + .into_iter() |
| 23 | - std::cmp::Ordering::Less => Some(clip), | 23 | + .filter_map(|(lane, mut clip)| match clip.source.cmp(&removed) { |
| 24 | - } | 24 | + std::cmp::Ordering::Equal => None, |
| 25 | + std::cmp::Ordering::Greater => { | ||
| 26 | + clip.source -= 1; | ||
| 27 | + Some((lane, clip)) | ||
| 28 | + } | ||
| 29 | + std::cmp::Ordering::Less => Some((lane, clip)), | ||
| 30 | + }) | ||
| 31 | + .collect() | ||
| 25 | } | 32 | } |
| 26 | 33 | ||
| 27 | /// One library row: a file and one of its audio streams. Plain data, planned | 34 | /// One library row: a file and one of its audio streams. Plain data, planned |
crates/app/src/main.rsmodified+14 -7
| @@ -298,9 +298,13 @@ struct Player { | |||
| 298 | /// reason (a VA-API init), and kept for the life of the process because the | 298 | /// reason (a VA-API init), and kept for the life of the process because the |
| 299 | /// answer cannot change while we run. `None` is "not asked yet". | 299 | /// answer cannot change while we run. `None` is "not asked yet". |
| 300 | hw_caps: Option<SharedString>, | 300 | hw_caps: Option<SharedString>, |
| 301 | - /// The copied clip. Frame ranges only, so it survives the clip it was taken | 301 | + /// The copied clip, or clips: frame ranges and the lane each was on, in |
| 302 | - /// from being deleted -- and it outlives the selection. | 302 | + /// click order, so it survives the clip (or clips) it was taken from |
| 303 | - clipboard: Option<Clip>, | 303 | + /// being deleted -- and it outlives the selection. One entry for a plain |
| 304 | + /// Copy, the whole ctrl-click set for one made over a selection; either | ||
| 305 | + /// way [`Player::paste`] drops the set at the playhead keeping the gaps | ||
| 306 | + /// and lanes between its members intact. | ||
| 307 | + clipboard: Vec<(Lane, Clip)>, | ||
| 304 | /// A drag that started on the ruler. Moves anywhere in the window scrub | 308 | /// A drag that started on the ruler. Moves anywhere in the window scrub |
| 305 | /// while it is set; the release commits the exact position. | 309 | /// while it is set; the release commits the exact position. |
| 306 | scrubbing: bool, | 310 | scrubbing: bool, |
| @@ -385,8 +389,11 @@ struct Player { | |||
| 385 | /// over no lane: the shadow every proper editor draws under a drag. Set by | 389 | /// over no lane: the shadow every proper editor draws under a drag. Set by |
| 386 | /// the lane the pointer is actually over -- that is the one question the | 390 | /// the lane the pointer is actually over -- that is the one question the |
| 387 | /// line above does not answer -- and drawn only while a drag is live, for | 391 | /// line above does not answer -- and drawn only while a drag is live, for |
| 388 | - /// [`Player::snap_cue`]'s reason. | 392 | + /// [`Player::snap_cue`]'s reason. More than one entry only while a |
| 389 | - ghost: Option<Ghost>, | 393 | + /// set-drag ([`Player::move_clip`]'s `set_move`) is carrying more than |
| 394 | + /// the clip under the hand: every other pick draws its own shadow too, at | ||
| 395 | + /// the same delta the anchor's is landing at ([`Player::preview_ghost`]). | ||
| 396 | + ghost: Vec<Ghost>, | ||
| 390 | /// The slot a track header being dragged is about to drop into, or `None` | 397 | /// The slot a track header being dragged is about to drop into, or `None` |
| 391 | /// while the pointer is over no lane: the line drawn between two headers, | 398 | /// while the pointer is over no lane: the line drawn between two headers, |
| 392 | /// for the reason [`Player::ghost`] draws a shadow -- where a gesture lands | 399 | /// for the reason [`Player::ghost`] draws a shadow -- where a gesture lands |
| @@ -929,7 +936,7 @@ fn main() { | |||
| 929 | decoders: HashMap::new(), | 936 | decoders: HashMap::new(), |
| 930 | export_seat: None, | 937 | export_seat: None, |
| 931 | hw_caps: None, | 938 | hw_caps: None, |
| 932 | - clipboard: None, | 939 | + clipboard: Vec::new(), |
| 933 | scrubbing: false, | 940 | scrubbing: false, |
| 934 | splits: load_stance_splits(bounds.size), | 941 | splits: load_stance_splits(bounds.size), |
| 935 | split_drag: None, | 942 | split_drag: None, |
| @@ -942,7 +949,7 @@ fn main() { | |||
| 942 | sub_folded: HashSet::new(), | 949 | sub_folded: HashSet::new(), |
| 943 | sub_lane: None, | 950 | sub_lane: None, |
| 944 | snap_cue: None, | 951 | snap_cue: None, |
| 945 | - ghost: None, | 952 | + ghost: Vec::new(), |
| 946 | lane_drop: None, | 953 | lane_drop: None, |
| 947 | last_scrub: Instant::now(), | 954 | last_scrub: Instant::now(), |
| 948 | last_target: 0, | 955 | last_target: 0, |
crates/app/src/player/actions.rsmodified+2 -2
| @@ -237,7 +237,7 @@ impl Player { | |||
| 237 | pub(crate) fn toggle_snap(&mut self, cx: &mut Context<Self>) { | 237 | pub(crate) fn toggle_snap(&mut self, cx: &mut Context<Self>) { |
| 238 | self.snap = !self.snap; | 238 | self.snap = !self.snap; |
| 239 | self.snap_cue = None; | 239 | self.snap_cue = None; |
| 240 | - self.ghost = None; | 240 | + self.ghost.clear(); |
| 241 | self.notify_user(match self.snap { | 241 | self.notify_user(match self.snap { |
| 242 | true => "SNAP ON — drags land on clip edges, the playhead and the start".into(), | 242 | true => "SNAP ON — drags land on clip edges, the playhead and the start".into(), |
| 243 | false => "SNAP OFF — drags land exactly where the hand leaves them".into(), | 243 | false => "SNAP OFF — drags land exactly where the hand leaves them".into(), |
| @@ -360,7 +360,7 @@ impl Player { | |||
| 360 | }), | 360 | }), |
| 361 | playhead: frame_at(session.now(), self.fps), | 361 | playhead: frame_at(session.now(), self.fps), |
| 362 | timeline: true, | 362 | timeline: true, |
| 363 | - clipboard: self.clipboard.is_some(), | 363 | + clipboard: !self.clipboard.is_empty(), |
| 364 | subtitles: !session.subtitles().is_empty(), | 364 | subtitles: !session.subtitles().is_empty(), |
| 365 | playable: !nothing_to_play(self.active_session()), | 365 | playable: !nothing_to_play(self.active_session()), |
| 366 | exporting: self.exporting().is_some(), | 366 | exporting: self.exporting().is_some(), |
crates/app/src/player/library.rsmodified+3 -3
| @@ -164,7 +164,7 @@ impl Player { | |||
| 164 | // A copied clip names its source by *index*, and every index | 164 | // A copied clip names its source by *index*, and every index |
| 165 | // past the one that went has just moved down: without this the | 165 | // past the one that went has just moved down: without this the |
| 166 | // next paste puts some other file on the timeline. | 166 | // next paste puts some other file on the timeline. |
| 167 | - self.clipboard = clipboard_after_remove(self.clipboard, idx); | 167 | + self.clipboard = clipboard_after_remove(std::mem::take(&mut self.clipboard), idx); |
| 168 | self.reset_after_reseek(); | 168 | self.reset_after_reseek(); |
| 169 | // The last row leaves a session naming no file: nothing to | 169 | // The last row leaves a session naming no file: nothing to |
| 170 | // play, nothing to save and nothing to show, which is the empty | 170 | // play, nothing to save and nothing to show, which is the empty |
| @@ -305,7 +305,7 @@ impl Player { | |||
| 305 | self.image = None; | 305 | self.image = None; |
| 306 | // The drawn cue with it, and its tile for the same reason as above. | 306 | // The drawn cue with it, and its tile for the same reason as above. |
| 307 | self.sub_image = None; | 307 | self.sub_image = None; |
| 308 | - self.clipboard = None; | 308 | + self.clipboard.clear(); |
| 309 | self.selected.clear(); | 309 | self.selected.clear(); |
| 310 | self.selected_asset = None; | 310 | self.selected_asset = None; |
| 311 | // The subtitle rows go with the timeline they were on, and so does the | 311 | // The subtitle rows go with the timeline they were on, and so does the |
| @@ -1486,7 +1486,7 @@ impl Player { | |||
| 1486 | self.name = file_name(path).into(); | 1486 | self.name = file_name(path).into(); |
| 1487 | // A copied clip names its source by index, which means a | 1487 | // A copied clip names its source by index, which means a |
| 1488 | // different file -- or none -- in another project. | 1488 | // different file -- or none -- in another project. |
| 1489 | - self.clipboard = None; | 1489 | + self.clipboard.clear(); |
| 1490 | self.selected.clear(); | 1490 | self.selected.clear(); |
| 1491 | // A menu can be up while a project is dropped on the window -- | 1491 | // A menu can be up while a project is dropped on the window -- |
| 1492 | // the scrim swallows clicks, never a drop -- and its index | 1492 | // the scrim swallows clicks, never a drop -- and its index |
crates/app/src/player/timeline_edit.rsmodified+187 -37
| @@ -250,18 +250,26 @@ impl Player { | |||
| 250 | cx.notify(); | 250 | cx.notify(); |
| 251 | } | 251 | } |
| 252 | 252 | ||
| 253 | - /// Copies the selected clip. Nothing on screen changes, so no notify. | 253 | + /// Copies the selection: one entry for a plain click, the whole |
| 254 | + /// ctrl-click set -- every pick, its own lane and its own frames -- for | ||
| 255 | + /// one made over more than a clip. Out of the lane each was clicked in: | ||
| 256 | + /// the audio half of a group is a different clip from the video one, and | ||
| 257 | + /// copying the wrong lane's frames is a paste of the wrong thing. Nothing | ||
| 258 | + /// on screen changes, so no notify. Empty rather than touched at all for | ||
| 259 | + /// a selection naming nothing any more, so a stale Copy leaves the | ||
| 260 | + /// clipboard exactly as a stale Paste would find it. | ||
| 254 | pub(crate) fn copy_selected(&mut self) { | 261 | pub(crate) fn copy_selected(&mut self) { |
| 255 | - let session = self.session.as_ref(); | 262 | + let Some(session) = self.session.as_ref() else { |
| 256 | - // Out of the lane it was clicked in: the audio half of a group is a | 263 | + return; |
| 257 | - // different clip from the video one, and copying the wrong lane's | 264 | + }; |
| 258 | - // frames is a paste of the wrong thing. | 265 | + let picks: Vec<(Lane, Clip)> = self |
| 259 | - if let Some(clip) = self | ||
| 260 | .selected | 266 | .selected |
| 261 | - .anchor() | 267 | + .picks() |
| 262 | - .and_then(|(lane, idx)| session?.lane_clips(lane).get(idx).copied()) | 268 | + .iter() |
| 263 | - { | 269 | + .filter_map(|&(lane, idx)| Some((lane, session.lane_clips(lane).get(idx).copied()?))) |
| 264 | - self.clipboard = Some(clip); | 270 | + .collect(); |
| 271 | + if !picks.is_empty() { | ||
| 272 | + self.clipboard = picks; | ||
| 265 | } | 273 | } |
| 266 | } | 274 | } |
| 267 | 275 | ||
| @@ -288,17 +296,37 @@ impl Player { | |||
| 288 | (picks, links) | 296 | (picks, links) |
| 289 | } | 297 | } |
| 290 | 298 | ||
| 291 | - /// Drops the copied clip in at the playhead. The engine reseeks itself, so | 299 | + /// Drops the copied clip -- or the whole copied set -- in at the |
| 292 | - /// like a delete this owes the flag reset -- and the selection, whose index | 300 | + /// playhead. A single clipboard entry takes the door it always has |
| 293 | - /// the insert has just moved. | 301 | + /// ([`PlaybackSession::paste_at`]): across `V1`/`A1`, splitting whatever |
| 302 | + /// it lands inside of and rippling the room open, byte-identical to | ||
| 303 | + /// before a set could be copied at all. More than one takes | ||
| 304 | + /// [`PlaybackSession::paste_set_at`] instead: every member lands on the | ||
| 305 | + /// lane it was copied off, at the same distance from the others it had on | ||
| 306 | + /// the bed it was copied from, refused whole rather than opening room -- | ||
| 307 | + /// see [`Project::paste_set`] for why a set-paste cannot ripple. The | ||
| 308 | + /// engine reseeks itself either way, so like a delete this owes the flag | ||
| 309 | + /// reset -- and the selection, whose index the insert has just moved. | ||
| 294 | pub(crate) fn paste(&mut self, cx: &mut Context<Self>) { | 310 | pub(crate) fn paste(&mut self, cx: &mut Context<Self>) { |
| 295 | - let pasted = match (&mut self.session, self.clipboard) { | 311 | + let pasted = match (&mut self.session, self.clipboard.as_slice()) { |
| 296 | - (Some(session), Some(clip)) => session.paste_at(session.now(), clip), | 312 | + (Some(session), [(_, clip)]) => session.paste_at(session.now(), *clip), |
| 313 | + (Some(session), items) if !items.is_empty() => { | ||
| 314 | + session.paste_set_at(session.now(), items) | ||
| 315 | + } | ||
| 297 | _ => false, | 316 | _ => false, |
| 298 | }; | 317 | }; |
| 299 | if pasted { | 318 | if pasted { |
| 300 | self.selected.clear(); | 319 | self.selected.clear(); |
| 301 | self.reset_after_reseek(); | 320 | self.reset_after_reseek(); |
| 321 | + } else if self.clipboard.len() > 1 { | ||
| 322 | + // The set-paste's own refusal, worded like a set-drag's | ||
| 323 | + // ([`Player::move_clip`]) -- a single-clip paste stays silent on | ||
| 324 | + // failure exactly as it always has. | ||
| 325 | + self.notify_user( | ||
| 326 | + "NOT PASTED — another clip already covers where one of the copied clips would \ | ||
| 327 | + land" | ||
| 328 | + .into(), | ||
| 329 | + ); | ||
| 302 | } | 330 | } |
| 303 | cx.notify(); | 331 | cx.notify(); |
| 304 | } | 332 | } |
| @@ -310,6 +338,13 @@ impl Player { | |||
| 310 | /// nothing is said about it. The engine reseeks, so all this owes is the | 338 | /// nothing is said about it. The engine reseeks, so all this owes is the |
| 311 | /// flag reset -- and the selection, whose index was that lane's own and now | 339 | /// flag reset -- and the selection, whose index was that lane's own and now |
| 312 | /// names a different clip there. | 340 | /// names a different clip there. |
| 341 | + /// | ||
| 342 | + /// A dragged clip that is *itself* one of the selection's picks carries the | ||
| 343 | + /// whole selection with it: every other pick moves the same frame delta, | ||
| 344 | + /// all-or-nothing ([`PlaybackSession::move_selection_to`]), and the picks | ||
| 345 | + /// survive the move -- their indices remapped rather than cleared, since a | ||
| 346 | + /// pick that travels still names the clip it named before. A clip dragged | ||
| 347 | + /// from outside the selection moves alone, exactly as it always has. | ||
| 313 | pub(crate) fn move_clip( | 348 | pub(crate) fn move_clip( |
| 314 | &mut self, | 349 | &mut self, |
| 315 | from: Lane, | 350 | from: Lane, |
| @@ -330,10 +365,23 @@ impl Player { | |||
| 330 | ) else { | 365 | ) else { |
| 331 | return; | 366 | return; |
| 332 | }; | 367 | }; |
| 333 | - let moved = self | 368 | + let set_move = self.selected.contains((from, idx)) && self.selected.len() > 1; |
| 334 | - .session | 369 | + let picks: Vec<(Lane, usize)> = self.selected.picks().to_vec(); |
| 335 | - .as_mut() | 370 | + // Every pick's own start, read before the move touches anything -- the |
| 336 | - .is_some_and(|session| session.move_clip_to(from, idx, to, start)); | 371 | + // only way to find a pick again afterwards, since a lane change or an |
| 372 | + // insert can move the index it was named by. | ||
| 373 | + let pre_starts: Vec<Option<u32>> = picks | ||
| 374 | + .iter() | ||
| 375 | + .map(|&(lane, i)| { | ||
| 376 | + self.session | ||
| 377 | + .as_ref() | ||
| 378 | + .and_then(|session| session.lane_clips(lane).get(i).map(|c| c.start)) | ||
| 379 | + }) | ||
| 380 | + .collect(); | ||
| 381 | + let moved = self.session.as_mut().is_some_and(|session| match set_move { | ||
| 382 | + true => session.move_selection_to(&picks, from, idx, to, start), | ||
| 383 | + false => session.move_clip_to(from, idx, to, start), | ||
| 384 | + }); | ||
| 337 | let (kind, lanes) = match from.kind { | 385 | let (kind, lanes) = match from.kind { |
| 338 | LaneKind::Video => ("picture", "video"), | 386 | LaneKind::Video => ("picture", "video"), |
| 339 | LaneKind::Audio => ("sound", "audio"), | 387 | LaneKind::Audio => ("sound", "audio"), |
| @@ -343,7 +391,18 @@ impl Player { | |||
| 343 | }; | 391 | }; |
| 344 | match moved { | 392 | match moved { |
| 345 | true => { | 393 | true => { |
| 346 | - self.selected.clear(); | 394 | + // Every pick named a `(lane, ...)` by index into that lane's |
| 395 | + // clips, sorted by start -- exactly what an insert or a lane | ||
| 396 | + // change reorders. Re-read by the frame each pick's clip now | ||
| 397 | + // starts at (recorded before the move moved anything), so the | ||
| 398 | + // selection survives naming the clips it named, not the slots | ||
| 399 | + // they used to sit in. | ||
| 400 | + if set_move { | ||
| 401 | + self.selected = | ||
| 402 | + self.remap_selection(&picks, &pre_starts, from, idx, to, was, start); | ||
| 403 | + } else { | ||
| 404 | + self.selected.clear(); | ||
| 405 | + } | ||
| 347 | self.reset_after_reseek(); | 406 | self.reset_after_reseek(); |
| 348 | } | 407 | } |
| 349 | // The three ways a drag is refused, told apart by what the | 408 | // The three ways a drag is refused, told apart by what the |
| @@ -360,6 +419,15 @@ impl Player { | |||
| 360 | // Picked up and put back down where it was: a click, and a click | 419 | // Picked up and put back down where it was: a click, and a click |
| 361 | // says nothing. | 420 | // says nothing. |
| 362 | false if from == to && start == was => {} | 421 | false if from == to && start == was => {} |
| 422 | + false if set_move => self.notify_user( | ||
| 423 | + format!( | ||
| 424 | + "NOT MOVED — {} clips selected, and another clip already covers where one of \ | ||
| 425 | + them would land on {}", | ||
| 426 | + picks.len(), | ||
| 427 | + to.label() | ||
| 428 | + ) | ||
| 429 | + .into(), | ||
| 430 | + ), | ||
| 363 | false => self.notify_user( | 431 | false => self.notify_user( |
| 364 | format!( | 432 | format!( |
| 365 | "NOT MOVED — another clip already covers those frames on {}", | 433 | "NOT MOVED — another clip already covers those frames on {}", |
| @@ -371,6 +439,50 @@ impl Player { | |||
| 371 | cx.notify(); | 439 | cx.notify(); |
| 372 | } | 440 | } |
| 373 | 441 | ||
| 442 | + /// What a selection's picks are called after a set-move that shifted every | ||
| 443 | + /// one of them by `landed - was` timeline frames (the delta the dragged | ||
| 444 | + /// clip's own head travelled, which every pick travelled too -- see | ||
| 445 | + /// [`Project::move_selection`]): the clip a pick named is found again by | ||
| 446 | + /// where it now starts, on the lane it stays on (or `to`, for the one | ||
| 447 | + /// that changed lane), rather than by the index it had, which a lane | ||
| 448 | + /// change or an insert can have moved. A pick whose clip cannot be found | ||
| 449 | + /// there any more (a bad index handed in) is dropped rather than guessed | ||
| 450 | + /// at. | ||
| 451 | + fn remap_selection( | ||
| 452 | + &self, | ||
| 453 | + picks: &[(Lane, usize)], | ||
| 454 | + pre_starts: &[Option<u32>], | ||
| 455 | + from: Lane, | ||
| 456 | + dragged: usize, | ||
| 457 | + to: Lane, | ||
| 458 | + was: u32, | ||
| 459 | + landed: u32, | ||
| 460 | + ) -> Selection { | ||
| 461 | + let mut out = Selection::new(); | ||
| 462 | + let Some(session) = self.session.as_ref() else { | ||
| 463 | + return out; | ||
| 464 | + }; | ||
| 465 | + let delta = i64::from(landed) - i64::from(was); | ||
| 466 | + for (&pick, &old_start) in picks.iter().zip(pre_starts) { | ||
| 467 | + let Some(old_start) = old_start else { | ||
| 468 | + continue; | ||
| 469 | + }; | ||
| 470 | + let want = (i64::from(old_start) + delta) as u32; | ||
| 471 | + // Every pick but the dragged clip itself stays on the lane it was | ||
| 472 | + // already on; only the exact clip the hand let go of changed | ||
| 473 | + // lane, so only its own pick is found on `to` rather than `from`. | ||
| 474 | + let now_lane = if pick == (from, dragged) { to } else { pick.0 }; | ||
| 475 | + if let Some(found) = session | ||
| 476 | + .lane_clips(now_lane) | ||
| 477 | + .iter() | ||
| 478 | + .position(|c| c.start == want) | ||
| 479 | + { | ||
| 480 | + out.add((now_lane, found)); | ||
| 481 | + } | ||
| 482 | + } | ||
| 483 | + out | ||
| 484 | + } | ||
| 485 | + | ||
| 374 | /// The whole of a palette track as a placement: from its own first | 486 | /// The whole of a palette track as a placement: from its own first |
| 375 | /// microsecond to its last cue, and as many timeline frames as that is worth | 487 | /// microsecond to its last cue, and as many timeline frames as that is worth |
| 376 | /// at this rate. What a row dragged out of the Subtitles list carries, and | 488 | /// at this rate. What a row dragged out of the Subtitles list carries, and |
| @@ -405,7 +517,7 @@ impl Player { | |||
| 405 | } | 517 | } |
| 406 | self.mark_dirty(); | 518 | self.mark_dirty(); |
| 407 | self.snap_cue = None; | 519 | self.snap_cue = None; |
| 408 | - self.ghost = None; | 520 | + self.ghost.clear(); |
| 409 | let at = self.place_frame(x).0; | 521 | let at = self.place_frame(x).0; |
| 410 | // What the mark is on, before the lane is renumbered: a caption's start | 522 | // What the mark is on, before the lane is renumbered: a caption's start |
| 411 | // frame is its name on its lane ([`sub_mark`]). | 523 | // frame is its name on its lane ([`sub_mark`]). |
| @@ -493,7 +605,7 @@ impl Player { | |||
| 493 | } | 605 | } |
| 494 | self.mark_dirty(); | 606 | self.mark_dirty(); |
| 495 | self.snap_cue = None; | 607 | self.snap_cue = None; |
| 496 | - self.ghost = None; | 608 | + self.ghost.clear(); |
| 497 | let Some(idx) = self.dragged_sub(drag) else { | 609 | let Some(idx) = self.dragged_sub(drag) else { |
| 498 | return; | 610 | return; |
| 499 | }; | 611 | }; |
| @@ -669,7 +781,7 @@ impl Player { | |||
| 669 | tint: CLIP_TEXT(), | 781 | tint: CLIP_TEXT(), |
| 670 | refused: to.kind != LaneKind::Subtitle, | 782 | refused: to.kind != LaneKind::Subtitle, |
| 671 | }; | 783 | }; |
| 672 | - self.set_ghost(Some(ghost), cx); | 784 | + self.set_ghost(vec![ghost], cx); |
| 673 | } | 785 | } |
| 674 | 786 | ||
| 675 | /// The same for a palette row on its way down: it lands at the frame it is | 787 | /// The same for a palette row on its way down: it lands at the frame it is |
| @@ -689,7 +801,7 @@ impl Player { | |||
| 689 | tint: CLIP_TEXT(), | 801 | tint: CLIP_TEXT(), |
| 690 | refused: to.kind != LaneKind::Subtitle, | 802 | refused: to.kind != LaneKind::Subtitle, |
| 691 | }; | 803 | }; |
| 692 | - self.set_ghost(Some(ghost), cx); | 804 | + self.set_ghost(vec![ghost], cx); |
| 693 | } | 805 | } |
| 694 | 806 | ||
| 695 | /// Where a clip let go at window `x` over lane `to` wants its head: the | 807 | /// Where a clip let go at window `x` over lane `to` wants its head: the |
| @@ -779,6 +891,15 @@ impl Player { | |||
| 779 | /// are one answer -- and its own length at this zoom. A lane of the other | 891 | /// are one answer -- and its own length at this zoom. A lane of the other |
| 780 | /// kind refuses the drop ([`Project::move_clip`]), and the shadow says so | 892 | /// kind refuses the drop ([`Project::move_clip`]), and the shadow says so |
| 781 | /// before the release does. | 893 | /// before the release does. |
| 894 | + /// | ||
| 895 | + /// When the dragged clip is itself one of a multi-pick selection (the same | ||
| 896 | + /// `set_move` test [`Player::move_clip`] commits by), every other pick | ||
| 897 | + /// draws its own shadow too, at the delta the anchor above is landing at -- | ||
| 898 | + /// [`Project::move_selection`]'s own clamp is not reread here, so a wall | ||
| 899 | + /// that would narrow the group's travel is seen only at the release, not | ||
| 900 | + /// in the shadow; the anchor's own room is still exact; corner-cut, ceiling | ||
| 901 | + /// a shadow a member or two too wide on a tight bed, upgrade is exposing | ||
| 902 | + /// `move_room` to preview against. | ||
| 782 | pub(crate) fn preview_ghost( | 903 | pub(crate) fn preview_ghost( |
| 783 | &mut self, | 904 | &mut self, |
| 784 | drag: &ClipDrag, | 905 | drag: &ClipDrag, |
| @@ -786,17 +907,46 @@ impl Player { | |||
| 786 | x: Pixels, | 907 | x: Pixels, |
| 787 | cx: &mut Context<Self>, | 908 | cx: &mut Context<Self>, |
| 788 | ) { | 909 | ) { |
| 789 | - let ghost = self | 910 | + let Some(idx) = self.dragged(drag) else { |
| 790 | - .dragged(drag) | 911 | + self.set_ghost(Vec::new(), cx); |
| 791 | - .and_then(|idx| self.drop_frame(drag.lane, idx, x)) | 912 | + return; |
| 792 | - .map(|(start, _)| Ghost { | 913 | + }; |
| 793 | - lane: to, | 914 | + let Some((start, _)) = self.drop_frame(drag.lane, idx, x) else { |
| 794 | - start, | 915 | + self.set_ghost(Vec::new(), cx); |
| 795 | - frames: drag.clip.frames(), | 916 | + return; |
| 796 | - tint: self.clip_tint(drag.clip.source), | 917 | + }; |
| 797 | - refused: drag.lane.kind != to.kind, | 918 | + let anchor = Ghost { |
| 798 | - }); | 919 | + lane: to, |
| 799 | - self.set_ghost(ghost, cx); | 920 | + start, |
| 921 | + frames: drag.clip.frames(), | ||
| 922 | + tint: self.clip_tint(drag.clip.source), | ||
| 923 | + refused: drag.lane.kind != to.kind, | ||
| 924 | + }; | ||
| 925 | + let mut ghosts = vec![anchor]; | ||
| 926 | + if self.selected.contains((drag.lane, idx)) && self.selected.len() > 1 { | ||
| 927 | + let delta = i64::from(start) - i64::from(drag.clip.start); | ||
| 928 | + for &(lane, i) in self.selected.picks() { | ||
| 929 | + if (lane, i) == (drag.lane, idx) { | ||
| 930 | + continue; | ||
| 931 | + } | ||
| 932 | + let Some(clip) = self | ||
| 933 | + .session | ||
| 934 | + .as_ref() | ||
| 935 | + .and_then(|session| session.lane_clips(lane).get(i).copied()) | ||
| 936 | + else { | ||
| 937 | + continue; | ||
| 938 | + }; | ||
| 939 | + let want = (i64::from(clip.start) + delta).max(0) as u32; | ||
| 940 | + ghosts.push(Ghost { | ||
| 941 | + lane, | ||
| 942 | + start: want, | ||
| 943 | + frames: clip.frames(), | ||
| 944 | + tint: self.clip_tint(clip.source), | ||
| 945 | + refused: anchor.refused, | ||
| 946 | + }); | ||
| 947 | + } | ||
| 948 | + } | ||
| 949 | + self.set_ghost(ghosts, cx); | ||
| 800 | } | 950 | } |
| 801 | 951 | ||
| 802 | /// The line the track in the hand would drop into, on the row the pointer | 952 | /// The line the track in the hand would drop into, on the row the pointer |
| @@ -860,7 +1010,7 @@ impl Player { | |||
| 860 | tint: file_tint(self.sources(), path).unwrap_or(BG_RAISED()), | 1010 | tint: file_tint(self.sources(), path).unwrap_or(BG_RAISED()), |
| 861 | refused: lane_refuses(path, to).is_some(), | 1011 | refused: lane_refuses(path, to).is_some(), |
| 862 | }; | 1012 | }; |
| 863 | - self.set_ghost(Some(ghost), cx); | 1013 | + self.set_ghost(vec![ghost], cx); |
| 864 | } | 1014 | } |
| 865 | 1015 | ||
| 866 | /// Sets the shadow, or takes it away, repainting only when it moved -- the | 1016 | /// Sets the shadow, or takes it away, repainting only when it moved -- the |
| @@ -868,7 +1018,7 @@ impl Player { | |||
| 868 | /// root and set again by the lane under the pointer, in that order (gpui | 1018 | /// root and set again by the lane under the pointer, in that order (gpui |
| 869 | /// runs the capture phase parent-first), so a pointer over no lane at all | 1019 | /// runs the capture phase parent-first), so a pointer over no lane at all |
| 870 | /// leaves nothing drawn. | 1020 | /// leaves nothing drawn. |
| 871 | - pub(crate) fn set_ghost(&mut self, ghost: Option<Ghost>, cx: &mut Context<Self>) { | 1021 | + pub(crate) fn set_ghost(&mut self, ghost: Vec<Ghost>, cx: &mut Context<Self>) { |
| 872 | if ghost != self.ghost { | 1022 | if ghost != self.ghost { |
| 873 | self.ghost = ghost; | 1023 | self.ghost = ghost; |
| 874 | cx.notify(); | 1024 | cx.notify(); |
crates/app/src/player/transport.rsmodified+1 -1
| @@ -254,7 +254,7 @@ impl Player { | |||
| 254 | // ...and the shadow a drag is drawn under promises a landing on a lane | 254 | // ...and the shadow a drag is drawn under promises a landing on a lane |
| 255 | // this edit has just reshaped. The next move of the drag draws it | 255 | // this edit has just reshaped. The next move of the drag draws it |
| 256 | // again; until then it says nothing. | 256 | // again; until then it says nothing. |
| 257 | - self.ghost = None; | 257 | + self.ghost.clear(); |
| 258 | } | 258 | } |
| 259 | 259 | ||
| 260 | /// Jumps the timeline. | 260 | /// Jumps the timeline. |
crates/app/src/render.rsmodified+4 -4
| @@ -607,12 +607,12 @@ impl Render for Player { | |||
| 607 | // (`lane_row`), which gpui runs straight after this one: the | 607 | // (`lane_row`), which gpui runs straight after this one: the |
| 608 | // capture phase goes parent first, so a pointer over no lane at | 608 | // capture phase goes parent first, so a pointer over no lane at |
| 609 | // all -- up in the library, say -- promises nothing. | 609 | // all -- up in the library, say -- promises nothing. |
| 610 | - this.set_ghost(None, cx); | 610 | + this.set_ghost(Vec::new(), cx); |
| 611 | })) | 611 | })) |
| 612 | .on_drag_move( | 612 | .on_drag_move( |
| 613 | cx.listener(|this, event: &DragMoveEvent<AssetDrag>, _, cx| { | 613 | cx.listener(|this, event: &DragMoveEvent<AssetDrag>, _, cx| { |
| 614 | this.preview_place(event.event.position.x, cx); | 614 | this.preview_place(event.event.position.x, cx); |
| 615 | - this.set_ghost(None, cx); | 615 | + this.set_ghost(Vec::new(), cx); |
| 616 | }), | 616 | }), |
| 617 | ) | 617 | ) |
| 618 | // The same pair for the two subtitle gestures, for the same reason: | 618 | // The same pair for the two subtitle gestures, for the same reason: |
| @@ -620,7 +620,7 @@ impl Render for Player { | |||
| 620 | // lane, and both are let go somewhere else entirely. | 620 | // lane, and both are let go somewhere else entirely. |
| 621 | .on_drag_move(cx.listener(|this, event: &DragMoveEvent<SubPick>, _, cx| { | 621 | .on_drag_move(cx.listener(|this, event: &DragMoveEvent<SubPick>, _, cx| { |
| 622 | this.preview_place(event.event.position.x, cx); | 622 | this.preview_place(event.event.position.x, cx); |
| 623 | - this.set_ghost(None, cx); | 623 | + this.set_ghost(Vec::new(), cx); |
| 624 | })) | 624 | })) |
| 625 | .on_drag_move(cx.listener(|this, event: &DragMoveEvent<SubDrag>, _, cx| { | 625 | .on_drag_move(cx.listener(|this, event: &DragMoveEvent<SubDrag>, _, cx| { |
| 626 | // The placement gpui froze into the payload, whose *length* is | 626 | // The placement gpui froze into the payload, whose *length* is |
| @@ -629,7 +629,7 @@ impl Render for Player { | |||
| 629 | let (drag, x) = (*event.drag(cx), event.event.position.x); | 629 | let (drag, x) = (*event.drag(cx), event.event.position.x); |
| 630 | let cue = this.sub_drop_frame(drag.sub, x).1; | 630 | let cue = this.sub_drop_frame(drag.sub, x).1; |
| 631 | this.set_cue(cue, x, cx); | 631 | this.set_cue(cue, x, cx); |
| 632 | - this.set_ghost(None, cx); | 632 | + this.set_ghost(Vec::new(), cx); |
| 633 | })) | 633 | })) |
| 634 | // Scrubbing is tracked on the root because the pointer leaves the | 634 | // Scrubbing is tracked on the root because the pointer leaves the |
| 635 | // 6 px ruler on the first drag and its own listeners then stop | 635 | // 6 px ruler on the first drag and its own listeners then stop |
crates/app/src/tests/editing.rsmodified+275 -6
| @@ -1685,19 +1685,35 @@ fn a_copied_clip_is_renumbered_or_dropped_when_a_row_leaves_the_library() { | |||
| 1685 | }; | 1685 | }; |
| 1686 | // Copied from source 2, source 0 removed: the same file is source 1 now. | 1686 | // Copied from source 2, source 0 removed: the same file is source 1 now. |
| 1687 | assert_eq!( | 1687 | assert_eq!( |
| 1688 | - clipboard_after_remove(Some(clip(2)), 0).map(|c| c.source), | 1688 | + clipboard_after_remove(vec![(Lane::V1, clip(2))], 0) |
| 1689 | - Some(1), | 1689 | + .into_iter() |
| 1690 | + .map(|(_, c)| c.source) | ||
| 1691 | + .collect::<Vec<_>>(), | ||
| 1692 | + vec![1], | ||
| 1690 | "the clipboard follows its file down the list" | 1693 | "the clipboard follows its file down the list" |
| 1691 | ); | 1694 | ); |
| 1692 | // Copied from a source *before* the one that went: untouched. | 1695 | // Copied from a source *before* the one that went: untouched. |
| 1693 | assert_eq!( | 1696 | assert_eq!( |
| 1694 | - clipboard_after_remove(Some(clip(0)), 2).map(|c| c.source), | 1697 | + clipboard_after_remove(vec![(Lane::V1, clip(0))], 2) |
| 1695 | - Some(0) | 1698 | + .into_iter() |
| 1699 | + .map(|(_, c)| c.source) | ||
| 1700 | + .collect::<Vec<_>>(), | ||
| 1701 | + vec![0] | ||
| 1696 | ); | 1702 | ); |
| 1697 | // Copied from the row that was just removed: there is nothing left to | 1703 | // Copied from the row that was just removed: there is nothing left to |
| 1698 | // paste, and pasting the next file along would be a lie. | 1704 | // paste, and pasting the next file along would be a lie. |
| 1699 | - assert!(clipboard_after_remove(Some(clip(1)), 1).is_none()); | 1705 | + assert!(clipboard_after_remove(vec![(Lane::V1, clip(1))], 1).is_empty()); |
| 1700 | - assert!(clipboard_after_remove(None, 0).is_none()); | 1706 | + assert!(clipboard_after_remove(Vec::new(), 0).is_empty()); |
| 1707 | + // A set with one member's file gone loses only that member -- the rest | ||
| 1708 | + // of the set survives to be pasted, gaps and lanes intact. | ||
| 1709 | + let trimmed = clipboard_after_remove( | ||
| 1710 | + vec![(Lane::V1, clip(1)), (Lane::A1, clip(2))], | ||
| 1711 | + 1, | ||
| 1712 | + ); | ||
| 1713 | + assert_eq!( | ||
| 1714 | + trimmed.into_iter().map(|(_, c)| c.source).collect::<Vec<_>>(), | ||
| 1715 | + vec![1] | ||
| 1716 | + ); | ||
| 1701 | } | 1717 | } |
| 1702 | 1718 | ||
| 1703 | /// The trim-a-clip path through the doors the edge drag uses: | 1719 | /// The trim-a-clip path through the doors the edge drag uses: |
| @@ -1897,6 +1913,259 @@ fn a_track_can_be_added_dropped_on_edited_and_taken_back() { | |||
| 1897 | assert_eq!(format_refusal(&session, Format::Mp4), None); | 1913 | assert_eq!(format_refusal(&session, Format::Mp4), None); |
| 1898 | } | 1914 | } |
| 1899 | 1915 | ||
| 1916 | +/// [`PlaybackSession::move_selection_to`], the door a selection drag uses | ||
| 1917 | +/// ([`Player::move_clip`]'s set path): three picks across two lanes, one of | ||
| 1918 | +/// them the dragged clip, all travel the *same* frame delta in one call -- | ||
| 1919 | +/// the same all-or-nothing clamp [`Project::move_room`] already gave a | ||
| 1920 | +/// linked group, generalised to an arbitrary selection. | ||
| 1921 | +#[test] | ||
| 1922 | +fn a_selection_drag_moves_every_pick_by_the_same_delta() { | ||
| 1923 | + use engine::project::LaneKind; | ||
| 1924 | + | ||
| 1925 | + let mut session = PlaybackSession::open(asset("test_av.mp4")).expect("open the fixture"); | ||
| 1926 | + session.set_gain(0.0); | ||
| 1927 | + let path = session.sources()[0].path.clone(); | ||
| 1928 | + session.import(&asset("test_av2.mp4")).expect("av2 matches"); | ||
| 1929 | + let second = session.sources()[1].path.clone(); | ||
| 1930 | + | ||
| 1931 | + // clip0 on V1 at the fixture's own start; clip1 on V1 ten seconds in, | ||
| 1932 | + // appended to the open bed and rippling nothing. | ||
| 1933 | + assert!(session | ||
| 1934 | + .place_stream_at(10.0, &second, 0, None) | ||
| 1935 | + .expect("av2 is on this timeline")); | ||
| 1936 | + let clip0 = session.lane_clips(Lane::V1)[0]; | ||
| 1937 | + let clip1 = session.lane_clips(Lane::V1)[1]; | ||
| 1938 | + assert_eq!((clip0.start, clip1.start), (0, 300)); | ||
| 1939 | + | ||
| 1940 | + // clipC on a second video row, well past both of the above. | ||
| 1941 | + let v2 = session.add_lane(LaneKind::Video); | ||
| 1942 | + assert!(session | ||
| 1943 | + .place_stream_at(20.0, &path, 0, Some(v2)) | ||
| 1944 | + .expect("test_av.mp4 is on this timeline")); | ||
| 1945 | + let clip_c = session.lane_clips(v2)[0]; | ||
| 1946 | + assert_eq!(clip_c.start, 600); | ||
| 1947 | + | ||
| 1948 | + let picks = [(Lane::V1, 0), (Lane::V1, 1), (v2, 0)]; | ||
| 1949 | + // Drag clip1 fifty frames along its own lane -- the other two picks own | ||
| 1950 | + // no neighbours of their own here, so nothing narrows the room and the | ||
| 1951 | + // full fifty-frame ask goes through for all three. | ||
| 1952 | + assert!(session.move_selection_to(&picks, Lane::V1, 1, Lane::V1, clip1.start + 50)); | ||
| 1953 | + assert_eq!(session.lane_clips(Lane::V1)[0].start, clip0.start + 50); | ||
| 1954 | + assert_eq!(session.lane_clips(Lane::V1)[1].start, clip1.start + 50); | ||
| 1955 | + assert_eq!(session.lane_clips(v2)[0].start, clip_c.start + 50); | ||
| 1956 | + // Every pick still names the clip it named: found again by the frame it | ||
| 1957 | + // now starts at -- exactly the lookup `Player::remap_selection` makes | ||
| 1958 | + // once the move lands, which is what keeps a set-move's selection alive | ||
| 1959 | + // rather than clearing it. | ||
| 1960 | + assert_eq!( | ||
| 1961 | + session.lane_clips(Lane::V1)[0], | ||
| 1962 | + Clip { start: clip0.start + 50, ..clip0 } | ||
| 1963 | + ); | ||
| 1964 | + assert_eq!( | ||
| 1965 | + session.lane_clips(v2)[0], | ||
| 1966 | + Clip { start: clip_c.start + 50, ..clip_c } | ||
| 1967 | + ); | ||
| 1968 | + | ||
| 1969 | + assert!(session.undo(), "one step for the whole set-move"); | ||
| 1970 | + assert_eq!(session.lane_clips(Lane::V1)[0].start, clip0.start); | ||
| 1971 | + assert_eq!(session.lane_clips(Lane::V1)[1].start, clip1.start); | ||
| 1972 | + assert_eq!(session.lane_clips(v2)[0].start, clip_c.start); | ||
| 1973 | +} | ||
| 1974 | + | ||
| 1975 | +/// One pick with nowhere to go refuses the whole set: the walk onto another | ||
| 1976 | +/// clip's own span that already refuses a lone drag | ||
| 1977 | +/// (`move_clip_keeps_the_frames_and_refuses_the_rest`, in this crate's own | ||
| 1978 | +/// engine tests) refuses a selection drag exactly the same way, and every | ||
| 1979 | +/// *other* pick -- which had all the room in the world -- stays exactly | ||
| 1980 | +/// where it was rather than moving on its own. | ||
| 1981 | +#[test] | ||
| 1982 | +fn a_selection_drag_refuses_as_one_set_when_any_pick_cannot_land() { | ||
| 1983 | + use engine::project::LaneKind; | ||
| 1984 | + | ||
| 1985 | + let mut session = PlaybackSession::open(asset("test_av.mp4")).expect("open the fixture"); | ||
| 1986 | + session.set_gain(0.0); | ||
| 1987 | + let path = session.sources()[0].path.clone(); | ||
| 1988 | + session.import(&asset("test_av2.mp4")).expect("av2 matches"); | ||
| 1989 | + let second = session.sources()[1].path.clone(); | ||
| 1990 | + | ||
| 1991 | + assert!(session | ||
| 1992 | + .place_stream_at(10.0, &second, 0, None) | ||
| 1993 | + .expect("av2 is on this timeline")); | ||
| 1994 | + let clip0 = session.lane_clips(Lane::V1)[0]; | ||
| 1995 | + let clip1 = session.lane_clips(Lane::V1)[1]; | ||
| 1996 | + | ||
| 1997 | + let v2 = session.add_lane(LaneKind::Video); | ||
| 1998 | + assert!(session | ||
| 1999 | + .place_stream_at(0.0, &path, 0, Some(v2)) | ||
| 2000 | + .expect("test_av.mp4 is on this timeline")); | ||
| 2001 | + let clip_c = session.lane_clips(v2)[0]; | ||
| 2002 | + // A clip clip1 is not picked, blocking the road on V2 the drag is about | ||
| 2003 | + // to try: clip1 dragged onto V2 lands its head inside this one. | ||
| 2004 | + assert!(session | ||
| 2005 | + .place_stream_at(10.0, &second, 0, Some(v2)) | ||
| 2006 | + .expect("av2 is on this timeline")); | ||
| 2007 | + let blocker = session.lane_clips(v2)[1]; | ||
| 2008 | + assert_eq!(blocker.start, 300); | ||
| 2009 | + | ||
| 2010 | + let picks = [(Lane::V1, 0), (Lane::V1, 1), (v2, 0)]; | ||
| 2011 | + // Dragged onto V2 at a frame inside the blocker: refused outright, the | ||
| 2012 | + // way a lone drag onto another clip already is. | ||
| 2013 | + assert!(!session.move_selection_to( | ||
| 2014 | + &picks, | ||
| 2015 | + Lane::V1, | ||
| 2016 | + 1, | ||
| 2017 | + v2, | ||
| 2018 | + blocker.start + 10 | ||
| 2019 | + )); | ||
| 2020 | + // Nothing moved -- not clip1 clamped short of the blocker, and not the | ||
| 2021 | + // two picks that had all the room to spare. | ||
| 2022 | + assert_eq!(session.lane_clips(Lane::V1)[0], clip0); | ||
| 2023 | + assert_eq!(session.lane_clips(Lane::V1)[1], clip1); | ||
| 2024 | + assert_eq!(session.lane_clips(v2)[0], clip_c); | ||
| 2025 | + assert_eq!(session.lane_clips(v2)[1], blocker); | ||
| 2026 | +} | ||
| 2027 | + | ||
| 2028 | +/// A plain click's copy is one clipboard entry, and one entry still takes | ||
| 2029 | +/// [`PlaybackSession::paste_at`] -- the door it always has, unchanged by a | ||
| 2030 | +/// set ever being able to ride [`PlaybackSession::paste_set_at`] instead. | ||
| 2031 | +#[test] | ||
| 2032 | +fn a_single_pick_copy_paste_round_trips_unchanged() { | ||
| 2033 | + let mut session = PlaybackSession::open(asset("test_av.mp4")).expect("open the fixture"); | ||
| 2034 | + session.set_gain(0.0); | ||
| 2035 | + // `open` seeds V1 with the whole fixture as its own clip -- what a plain | ||
| 2036 | + // click would copy. | ||
| 2037 | + let copied = session.lane_clips(Lane::V1)[0]; | ||
| 2038 | + | ||
| 2039 | + let at = session.timeline_duration(); | ||
| 2040 | + assert!(session.paste_at(at, copied), "a free spot always takes it"); | ||
| 2041 | + let pasted = session.lane_clips(Lane::V1)[1]; | ||
| 2042 | + assert_eq!( | ||
| 2043 | + (pasted.source, pasted.in_frame, pasted.out_frame), | ||
| 2044 | + (copied.source, copied.in_frame, copied.out_frame), | ||
| 2045 | + "the pasted clip plays the same source frames the copy did" | ||
| 2046 | + ); | ||
| 2047 | + | ||
| 2048 | + assert!(session.undo(), "one step for the paste"); | ||
| 2049 | + assert_eq!(session.lane_clips(Lane::V1).len(), 1); | ||
| 2050 | +} | ||
| 2051 | + | ||
| 2052 | +/// [`PlaybackSession::paste_set_at`], the set-copy's own door | ||
| 2053 | +/// ([`Player::paste`]'s multi-entry path): three picks across two lanes, some | ||
| 2054 | +/// distance apart, keep that same distance and the same lane each landed on | ||
| 2055 | +/// -- the offset [`Project::paste_set`] moves every item by is the one from | ||
| 2056 | +/// the earliest pick to `at`, not a collapse onto `V1`/`A1`. | ||
| 2057 | +#[test] | ||
| 2058 | +fn a_three_pick_copy_paste_preserves_gaps_and_lane_assignment() { | ||
| 2059 | + use engine::project::LaneKind; | ||
| 2060 | + | ||
| 2061 | + let mut session = PlaybackSession::open(asset("test_av.mp4")).expect("open the fixture"); | ||
| 2062 | + session.set_gain(0.0); | ||
| 2063 | + let path = session.sources()[0].path.clone(); | ||
| 2064 | + session.import(&asset("test_av2.mp4")).expect("av2 matches"); | ||
| 2065 | + let second = session.sources()[1].path.clone(); | ||
| 2066 | + | ||
| 2067 | + assert!(session | ||
| 2068 | + .place_stream_at(10.0, &second, 0, None) | ||
| 2069 | + .expect("av2 is on this timeline")); | ||
| 2070 | + let clip0 = session.lane_clips(Lane::V1)[0]; | ||
| 2071 | + let clip1 = session.lane_clips(Lane::V1)[1]; | ||
| 2072 | + | ||
| 2073 | + let v2 = session.add_lane(LaneKind::Video); | ||
| 2074 | + assert!(session | ||
| 2075 | + .place_stream_at(20.0, &path, 0, Some(v2)) | ||
| 2076 | + .expect("test_av.mp4 is on this timeline")); | ||
| 2077 | + let clip_c = session.lane_clips(v2)[0]; | ||
| 2078 | + | ||
| 2079 | + // Copied in click order, out of the lanes each was clicked in -- exactly | ||
| 2080 | + // what `Player::copy_selected` builds. | ||
| 2081 | + let items = [(Lane::V1, clip0), (Lane::V1, clip1), (v2, clip_c)]; | ||
| 2082 | + let at = session.timeline_duration(); | ||
| 2083 | + assert!(session.paste_set_at(at, &items), "a free spot takes the set"); | ||
| 2084 | + | ||
| 2085 | + let new0 = session.lane_clips(Lane::V1)[2]; | ||
| 2086 | + let new1 = session.lane_clips(Lane::V1)[3]; | ||
| 2087 | + let new_c = session.lane_clips(v2)[1]; | ||
| 2088 | + // The gaps between picks survive the trip untouched. | ||
| 2089 | + assert_eq!(new1.start - new0.start, clip1.start - clip0.start); | ||
| 2090 | + assert_eq!(new_c.start - new0.start, clip_c.start - clip0.start); | ||
| 2091 | + // And each still plays the source frames it was copied with, off the | ||
| 2092 | + // lane it was copied off of. | ||
| 2093 | + assert_eq!( | ||
| 2094 | + (new0.source, new0.in_frame, new0.out_frame), | ||
| 2095 | + (clip0.source, clip0.in_frame, clip0.out_frame) | ||
| 2096 | + ); | ||
| 2097 | + assert_eq!( | ||
| 2098 | + (new_c.source, new_c.in_frame, new_c.out_frame), | ||
| 2099 | + (clip_c.source, clip_c.in_frame, clip_c.out_frame) | ||
| 2100 | + ); | ||
| 2101 | + | ||
| 2102 | + assert!(session.undo(), "one step for the whole set-paste"); | ||
| 2103 | + assert_eq!(session.lane_clips(Lane::V1).len(), 2); | ||
| 2104 | + assert_eq!(session.lane_clips(v2).len(), 1); | ||
| 2105 | +} | ||
| 2106 | + | ||
| 2107 | +/// A set-paste never ripples the bed: a landing that would overlap so much | ||
| 2108 | +/// as one existing clip on its own lane refuses the *whole* set, exactly as | ||
| 2109 | +/// [`Project::paste_set`] documents, leaving the project as it was rather | ||
| 2110 | +/// than placing the picks that had room to spare. | ||
| 2111 | +#[test] | ||
| 2112 | +fn a_colliding_set_paste_refuses_whole() { | ||
| 2113 | + use engine::project::LaneKind; | ||
| 2114 | + | ||
| 2115 | + let mut session = PlaybackSession::open(asset("test_av.mp4")).expect("open the fixture"); | ||
| 2116 | + session.set_gain(0.0); | ||
| 2117 | + let path = session.sources()[0].path.clone(); | ||
| 2118 | + session.import(&asset("test_av2.mp4")).expect("av2 matches"); | ||
| 2119 | + let second = session.sources()[1].path.clone(); | ||
| 2120 | + | ||
| 2121 | + assert!(session | ||
| 2122 | + .place_stream_at(10.0, &second, 0, None) | ||
| 2123 | + .expect("av2 is on this timeline")); | ||
| 2124 | + let clip0 = session.lane_clips(Lane::V1)[0]; | ||
| 2125 | + let clip1 = session.lane_clips(Lane::V1)[1]; | ||
| 2126 | + | ||
| 2127 | + let v2 = session.add_lane(LaneKind::Video); | ||
| 2128 | + assert!(session | ||
| 2129 | + .place_stream_at(20.0, &path, 0, Some(v2)) | ||
| 2130 | + .expect("test_av.mp4 is on this timeline")); | ||
| 2131 | + let clip_c = session.lane_clips(v2)[0]; | ||
| 2132 | + | ||
| 2133 | + let items = [(Lane::V1, clip0), (Lane::V1, clip1), (v2, clip_c)]; | ||
| 2134 | + // A blocker sat right where the V1 half of the set would land: pasting | ||
| 2135 | + // at the timeline's own start walks every item straight back onto the | ||
| 2136 | + // lanes it was copied off of, colliding with everything already there. | ||
| 2137 | + assert!(!session.paste_set_at(0.0, &items)); | ||
| 2138 | + | ||
| 2139 | + assert_eq!(session.lane_clips(Lane::V1)[0], clip0); | ||
| 2140 | + assert_eq!(session.lane_clips(Lane::V1)[1], clip1); | ||
| 2141 | + assert_eq!(session.lane_clips(v2)[0], clip_c); | ||
| 2142 | + assert_eq!(session.lane_clips(Lane::V1).len(), 2); | ||
| 2143 | + assert_eq!(session.lane_clips(v2).len(), 1); | ||
| 2144 | +} | ||
| 2145 | + | ||
| 2146 | +/// The refactor `move_clip` -> `move_selection` owes: a clip dragged from | ||
| 2147 | +/// outside the selection (or with nothing else selected) moves exactly as it | ||
| 2148 | +/// always has -- `move_clip_to`'s own door and `move_selection_to`'s | ||
| 2149 | +/// selection-of-one both walk the same code, so they cannot drift apart. | ||
| 2150 | +#[test] | ||
| 2151 | +fn a_lone_clip_drag_is_unchanged_by_the_selection_path() { | ||
| 2152 | + use engine::project::LaneKind; | ||
| 2153 | + | ||
| 2154 | + let mut session = PlaybackSession::open(asset("test_av.mp4")).expect("open the fixture"); | ||
| 2155 | + session.set_gain(0.0); | ||
| 2156 | + let v2 = session.add_lane(LaneKind::Video); | ||
| 2157 | + | ||
| 2158 | + assert!(session.move_clip_to(Lane::V1, 0, v2, 0), "V1 -> V2"); | ||
| 2159 | + assert!(session.lane_clips(Lane::V1).is_empty()); | ||
| 2160 | + assert_eq!(session.lane_clips(v2).len(), 1); | ||
| 2161 | + | ||
| 2162 | + // The other kind of lane is refused exactly as before. | ||
| 2163 | + assert!(!session.move_clip_to(v2, 0, Lane::A1, 0)); | ||
| 2164 | + // A drop back where it was picked up is a click, still refused. | ||
| 2165 | + let clip = session.lane_clips(v2)[0]; | ||
| 2166 | + assert!(!session.move_clip_to(v2, 0, v2, clip.start)); | ||
| 2167 | +} | ||
| 2168 | + | ||
| 1900 | /// A caption grouped with a clip on an *added* lane closes its lane's hole | 2169 | /// A caption grouped with a clip on an *added* lane closes its lane's hole |
| 1901 | /// too, not just the first pair's: the same law commit `cdc53a6` gave `V1` | 2170 | /// too, not just the first pair's: the same law commit `cdc53a6` gave `V1` |
| 1902 | /// (`whole_take` -> `Project::delete_members`) has to hold from every anchor | 2171 | /// (`whole_take` -> `Project::delete_members`) has to hold from every anchor |
crates/app/src/ui/bench_stance.rsmodified+2 -0
| @@ -1124,6 +1124,8 @@ fn lane_row( | |||
| 1124 | .children( | 1124 | .children( |
| 1125 | player | 1125 | player |
| 1126 | .ghost | 1126 | .ghost |
| 1127 | + .iter() | ||
| 1128 | + .copied() | ||
| 1127 | .filter(|g| g.lane == lane && cx.has_active_drag()) | 1129 | .filter(|g| g.lane == lane && cx.has_active_drag()) |
| 1128 | .map(|g| { | 1130 | .map(|g| { |
| 1129 | div() | 1131 | div() |
crates/app/src/ui/timeline.rsmodified+9 -5
| @@ -850,11 +850,15 @@ impl Player { | |||
| 850 | .snap_cue | 850 | .snap_cue |
| 851 | .filter(|_| self.trim.is_some() || cx.has_active_drag()) | 851 | .filter(|_| self.trim.is_some() || cx.has_active_drag()) |
| 852 | .map(|frame| scale.px_at(f64::from(frame) / self.fps)); | 852 | .map(|frame| scale.px_at(f64::from(frame) / self.fps)); |
| 853 | - // The shadow, on the one lane the pointer is over -- and, like the line, | 853 | + // The shadow (or shadows, on a set-drag -- [`Player::preview_ghost`]), |
| 854 | - // only while the drag that asked for it is still in flight. | 854 | + // on the one lane each names -- and, like the line, only while the |
| 855 | - let ghost = self | 855 | + // drag that asked for it is still in flight. |
| 856 | + let ghost: Vec<Ghost> = self | ||
| 856 | .ghost | 857 | .ghost |
| 857 | - .filter(|g| g.lane == lane && cx.has_active_drag()); | 858 | + .iter() |
| 859 | + .copied() | ||
| 860 | + .filter(|g| g.lane == lane && cx.has_active_drag()) | ||
| 861 | + .collect(); | ||
| 858 | let clips = self | 862 | let clips = self |
| 859 | .session | 863 | .session |
| 860 | .as_ref() | 864 | .as_ref() |
| @@ -1919,7 +1923,7 @@ impl Player { | |||
| 1919 | // under a drag. Over the clips (it is translucent, so what | 1923 | // under a drag. Over the clips (it is translucent, so what |
| 1920 | // it would cover shows through) and under the line, which | 1924 | // it would cover shows through) and under the line, which |
| 1921 | // marks the frame this box merely fills. | 1925 | // marks the frame this box merely fills. |
| 1922 | - .children(ghost.map(|g| { | 1926 | + .children(ghost.into_iter().map(|g| { |
| 1923 | div() | 1927 | div() |
| 1924 | .absolute() | 1928 | .absolute() |
| 1925 | .top_0() | 1929 | .top_0() |
crates/engine/src/playback.rsmodified+26 -0
| @@ -2374,6 +2374,22 @@ impl PlaybackSession { | |||
| 2374 | self.edit(Dirty::Both, |p| p.move_clip(from, idx, to, start)) | 2374 | self.edit(Dirty::Both, |p| p.move_clip(from, idx, to, start)) |
| 2375 | } | 2375 | } |
| 2376 | 2376 | ||
| 2377 | + /// [`move_clip_to`](Self::move_clip_to)'s general form: every one of | ||
| 2378 | + /// `picks` travels the same frame delta as the dragged clip at `idx` of | ||
| 2379 | + /// `from`, all-or-nothing, one undo step for the lot -- what a hand drags | ||
| 2380 | + /// on a selection rather than a lone clip. See | ||
| 2381 | + /// [`Project::move_selection`] for the clamp that makes it all-or-nothing. | ||
| 2382 | + pub fn move_selection_to( | ||
| 2383 | + &mut self, | ||
| 2384 | + picks: &[(Lane, usize)], | ||
| 2385 | + from: Lane, | ||
| 2386 | + idx: usize, | ||
| 2387 | + to: Lane, | ||
| 2388 | + start: u32, | ||
| 2389 | + ) -> bool { | ||
| 2390 | + self.edit(Dirty::Both, |p| p.move_selection(picks, from, idx, to, start)) | ||
| 2391 | + } | ||
| 2392 | + | ||
| 2377 | /// Drags one end of that clip to timeline frame `to`, changing how much of | 2393 | /// Drags one end of that clip to timeline frame `to`, changing how much of |
| 2378 | /// its source it plays and nothing else on the lane -- see [`Project::trim`] | 2394 | /// its source it plays and nothing else on the lane -- see [`Project::trim`] |
| 2379 | /// for the walls it is clamped by, which this fills the source lengths in | 2395 | /// for the walls it is clamped by, which this fills the source lengths in |
| @@ -2937,6 +2953,16 @@ impl PlaybackSession { | |||
| 2937 | self.edit(Dirty::Both, |p| p.paste(at, clip)) | 2953 | self.edit(Dirty::Both, |p| p.paste(at, clip)) |
| 2938 | } | 2954 | } |
| 2939 | 2955 | ||
| 2956 | + /// [`paste_at`](Self::paste_at)'s general form: [`Project::paste_set`]'s | ||
| 2957 | + /// door, clamped to the timeline's own end the same way -- a set let go | ||
| 2958 | + /// past the last frame lands there rather than carrying black in front of | ||
| 2959 | + /// it, exactly as a lone clip's paste does. | ||
| 2960 | + pub fn paste_set_at(&mut self, timeline_secs: f64, items: &[(Lane, Clip)]) -> bool { | ||
| 2961 | + let at = secs_to_frame(timeline_secs, self.meta.frame_rate) | ||
| 2962 | + .min(self.project.timeline_frames()); | ||
| 2963 | + self.edit(Dirty::Both, |p| p.paste_set(at, items)) | ||
| 2964 | + } | ||
| 2965 | + | ||
| 2940 | /// Places the whole of `path` played on its audio `stream` at | 2966 | /// Places the whole of `path` played on its audio `stream` at |
| 2941 | /// `timeline_secs`, the way [`paste_at`](Self::paste_at) places a copy -- | 2967 | /// `timeline_secs`, the way [`paste_at`](Self::paste_at) places a copy -- |
| 2942 | /// the door a library row goes through, and the only way a stream other | 2968 | /// the door a library row goes through, and the only way a stream other |
crates/engine/src/project.rsmodified+119 -7
| @@ -3591,23 +3591,71 @@ impl Project { | |||
| 3591 | /// is on, and a drop that changes neither lane nor frame, which is a clip | 3591 | /// is on, and a drop that changes neither lane nor frame, which is a clip |
| 3592 | /// picked up and put back down, i.e. a click. | 3592 | /// picked up and put back down, i.e. a click. |
| 3593 | pub fn move_clip(&mut self, from: Lane, idx: usize, to: Lane, start: u32) -> bool { | 3593 | pub fn move_clip(&mut self, from: Lane, idx: usize, to: Lane, start: u32) -> bool { |
| 3594 | + self.move_selection(&[(from, idx)], from, idx, to, start) | ||
| 3595 | + } | ||
| 3596 | + | ||
| 3597 | + /// [`move_clip`](Self::move_clip)'s general form: every pick in `picks` | ||
| 3598 | + /// (each with its own link group, exactly as [`group_of`](Self::group_of) | ||
| 3599 | + /// reads it) travels the same distance as the clip at `idx` of `from`, | ||
| 3600 | + /// which alone changes lane, onto `to`. One clamp across the whole set | ||
| 3601 | + /// ([`move_room`](Self::move_room)) is what makes this all-or-nothing: a | ||
| 3602 | + /// neighbour that boxes in *any* member narrows the delta every member | ||
| 3603 | + /// moves by, and a member with no room at all (`lo > hi`) refuses the | ||
| 3604 | + /// whole set rather than moving the rest and leaving that one behind. | ||
| 3605 | + /// `move_clip` is this with a selection of one -- the dragged clip's own | ||
| 3606 | + /// group and nothing else -- so a drag on a clip outside the selection is | ||
| 3607 | + /// byte-identical to before this existed. | ||
| 3608 | + pub fn move_selection( | ||
| 3609 | + &mut self, | ||
| 3610 | + picks: &[(Lane, usize)], | ||
| 3611 | + from: Lane, | ||
| 3612 | + idx: usize, | ||
| 3613 | + to: Lane, | ||
| 3614 | + start: u32, | ||
| 3615 | + ) -> bool { | ||
| 3594 | let (Some(dest), Some(clip)) = (self.index(to), self.lane(from).get(idx).copied()) else { | 3616 | let (Some(dest), Some(clip)) = (self.index(to), self.lane(from).get(idx).copied()) else { |
| 3595 | return false; | 3617 | return false; |
| 3596 | }; | 3618 | }; |
| 3597 | if from.kind != to.kind { | 3619 | if from.kind != to.kind { |
| 3598 | return false; | 3620 | return false; |
| 3599 | } | 3621 | } |
| 3600 | - let members = self.group_of(from, idx).expect("the clip was found"); | ||
| 3601 | let held = self.index(from).expect("the clip was found on it"); | 3622 | let held = self.index(from).expect("the clip was found on it"); |
| 3602 | - // The two halves of one group would land on one span of one lane, which | 3623 | + // Every pick's own group, unioned: the whole selection moves as one, |
| 3603 | - // is the one thing a link may never mean. Refused rather than clamped: | 3624 | + // and a pick's link partners (not themselves picked) come along with |
| 3604 | - // the partner moves the same distance, so there is no room for it | 3625 | + // it exactly as a lone drag's do. |
| 3605 | - // anywhere on that lane. | 3626 | + let mut members = Members::default(); |
| 3627 | + for &(lane, i) in picks { | ||
| 3628 | + let Some(group) = self.group_of(lane, i) else { | ||
| 3629 | + continue; | ||
| 3630 | + }; | ||
| 3631 | + for m in group.clips { | ||
| 3632 | + if !members.clips.contains(&m) { | ||
| 3633 | + members.clips.push(m); | ||
| 3634 | + } | ||
| 3635 | + } | ||
| 3636 | + for m in group.subs { | ||
| 3637 | + if !members.subs.contains(&m) { | ||
| 3638 | + members.subs.push(m); | ||
| 3639 | + } | ||
| 3640 | + } | ||
| 3641 | + } | ||
| 3642 | + if !members.clips.contains(&(held, idx)) { | ||
| 3643 | + members.clips.push((held, idx)); | ||
| 3644 | + } | ||
| 3645 | + // The two halves of *the dragged clip's own* group would land on one | ||
| 3646 | + // span of one lane, which is the one thing a link may never mean -- | ||
| 3647 | + // checked against that group alone, not the whole moving set: an | ||
| 3648 | + // unlinked fellow pick already sitting on `dest` is no conflict at | ||
| 3649 | + // all, since it travels by the same delta and `move_room` below | ||
| 3650 | + // leaves it the room to. Refused rather than clamped: the partner | ||
| 3651 | + // moves the same distance, so there is no room for it anywhere on | ||
| 3652 | + // that lane. | ||
| 3653 | + let own_group = self.group_of(from, idx).expect("the clip was found"); | ||
| 3606 | if dest != held | 3654 | if dest != held |
| 3607 | - && members | 3655 | + && own_group |
| 3608 | .clips | 3656 | .clips |
| 3609 | .iter() | 3657 | .iter() |
| 3610 | - .chain(&members.subs) | 3658 | + .chain(&own_group.subs) |
| 3611 | .any(|&(l, _)| l == dest) | 3659 | .any(|&(l, _)| l == dest) |
| 3612 | { | 3660 | { |
| 3613 | return false; | 3661 | return false; |
| @@ -4156,6 +4204,70 @@ impl Project { | |||
| 4156 | true | 4204 | true |
| 4157 | } | 4205 | } |
| 4158 | 4206 | ||
| 4207 | + /// [`paste`](Project::paste)'s general form: every `(lane, clip)` in | ||
| 4208 | + /// `items` lands on the lane it names, its head moved by the offset every | ||
| 4209 | + /// other item moves by too -- `at` less the earliest `start` among them, | ||
| 4210 | + /// so the set's own gaps and lane assignment survive the trip from | ||
| 4211 | + /// clipboard to bed unchanged, rather than collapsing onto `V1`/`A1` the | ||
| 4212 | + /// way a lone clip's copy does. | ||
| 4213 | + /// | ||
| 4214 | + /// All-or-nothing, and **refused** rather than opening room or splitting | ||
| 4215 | + /// a neighbour the way [`paste`](Project::paste) does for one clip: | ||
| 4216 | + /// a set-paste never ripples the bed, so a landing that overlaps so much | ||
| 4217 | + /// as one existing clip on its own lane refuses the whole set, changing | ||
| 4218 | + /// nothing -- the paste's own [`move_selection`](Project::move_selection) | ||
| 4219 | + /// clamps instead of refusing, but a paste has no drag to clamp against, | ||
| 4220 | + /// and a landing moved off the frame asked for is not what a paste means. | ||
| 4221 | + /// `items` empty, naming a lane or a source that is not there, or a clip | ||
| 4222 | + /// with `out_frame <= in_frame`, refuses too, before anything is touched. | ||
| 4223 | + /// | ||
| 4224 | + /// Exactly one history snapshot for the whole set, so one | ||
| 4225 | + /// [`Project::undo`] takes it back. Changes the timeline->source mapping | ||
| 4226 | + /// on every lane an item lands on: the caller must reseek. | ||
| 4227 | + pub fn paste_set(&mut self, at: u32, items: &[(Lane, Clip)]) -> bool { | ||
| 4228 | + let Some(anchor) = items.iter().map(|(_, c)| c.start).min() else { | ||
| 4229 | + return false; | ||
| 4230 | + }; | ||
| 4231 | + // Resolved once, up front, off the lanes as they stand now: a lane or | ||
| 4232 | + // source that is not there, or a landing that would overlap a | ||
| 4233 | + // neighbour, refuses the whole set before any of it is written. | ||
| 4234 | + let mut landings: Vec<(usize, Clip)> = Vec::with_capacity(items.len()); | ||
| 4235 | + for &(lane, clip) in items { | ||
| 4236 | + let Some(li) = self.index(lane) else { | ||
| 4237 | + return false; | ||
| 4238 | + }; | ||
| 4239 | + if self.sources.get(clip.source).is_none() || clip.out_frame <= clip.in_frame { | ||
| 4240 | + return false; | ||
| 4241 | + } | ||
| 4242 | + let delta = i64::from(clip.start) - i64::from(anchor); | ||
| 4243 | + let Ok(start) = u32::try_from(i64::from(at) + delta) else { | ||
| 4244 | + return false; | ||
| 4245 | + }; | ||
| 4246 | + let Some(end) = start.checked_add(clip.frames()) else { | ||
| 4247 | + return false; | ||
| 4248 | + }; | ||
| 4249 | + if self.lanes[li] | ||
| 4250 | + .clips | ||
| 4251 | + .iter() | ||
| 4252 | + .any(|c| c.start < end && start < c.end()) | ||
| 4253 | + { | ||
| 4254 | + return false; | ||
| 4255 | + } | ||
| 4256 | + landings.push((li, Clip { start, ..clip })); | ||
| 4257 | + } | ||
| 4258 | + self.snapshot(); | ||
| 4259 | + for (li, mut clip) in landings { | ||
| 4260 | + clip.link = Some(self.new_link()); | ||
| 4261 | + clip.fade_in = 0; | ||
| 4262 | + clip.fade_out = 0; | ||
| 4263 | + clip.transition_out = 0; | ||
| 4264 | + let clips = &mut self.lanes[li].clips; | ||
| 4265 | + let idx = clips.partition_point(|c| c.start < clip.start); | ||
| 4266 | + clips.insert(idx, clip); | ||
| 4267 | + } | ||
| 4268 | + true | ||
| 4269 | + } | ||
| 4270 | + | ||
| 4159 | /// Lift the clip at `idx` out of `lane`, leaving a gap: black frames or | 4271 | /// Lift the clip at `idx` out of `lane`, leaving a gap: black frames or |
| 4160 | /// silence, and nothing else moves. Refused only for an out-of-range index | 4272 | /// silence, and nothing else moves. Refused only for an out-of-range index |
| 4161 | /// (which a lane that is not there always is) -- lifting the last placement | 4273 | /// (which a lane that is not there always is) -- lifting the last placement |