mirror of
https://github.com/johrpan/musicus.git
synced 2025-10-26 19:57:25 +01:00
editor: Implement drag and drop where it makes sense
This commit is contained in:
parent
a13e406e99
commit
e47b7c2006
31 changed files with 888 additions and 87 deletions
|
|
@ -268,6 +268,20 @@ impl TracksEditor {
|
|||
let track_row =
|
||||
TracksEditorTrackRow::new(&self.navigation(), &self.library(), recording, track_data);
|
||||
|
||||
track_row.connect_move(clone!(
|
||||
#[weak(rename_to = this)]
|
||||
self,
|
||||
move |target, source| {
|
||||
let mut track_rows = this.imp().track_rows.borrow_mut();
|
||||
if let Some(index) = track_rows.iter().position(|p| p == target) {
|
||||
this.imp().track_list.remove(&source);
|
||||
track_rows.retain(|p| p != &source);
|
||||
this.imp().track_list.insert(&source, index as i32);
|
||||
track_rows.insert(index, source);
|
||||
}
|
||||
}
|
||||
));
|
||||
|
||||
track_row.connect_remove(clone!(
|
||||
#[weak(rename_to = this)]
|
||||
self,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue