Skip to content

Commit

Permalink
focus window of already loaded module if user attempts to load a dupl…
Browse files Browse the repository at this point in the history
…icate
  • Loading branch information
B0ney committed Feb 4, 2024
1 parent 7dea454 commit 5fa7811
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/screen/sample_player/preview_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,14 @@ impl SamplePreview {
self.get_window_mut(id).hovered = hovered;
}

// TODO: flash window of already loaded sample if user attempts to load duplicate
pub fn load_samples(&mut self, id: Id, path: PathBuf) -> Command<Message> {
self.get_window_mut(id)
.load_samples(path)
.map(move |result| Message::Window(id, result))
match self.find(&path) {
Some(old_id) if old_id != id => window::gain_focus(old_id),
_ => self
.get_window_mut(id)
.load_samples(path)
.map(move |result| Message::Window(id, result)),
}
}

// find a window that already has a tracker loaded
Expand Down

0 comments on commit 5fa7811

Please sign in to comment.