Skip to content

Commit 56a2c27

Browse files
committed
support drag&drop of files
1 parent 8d9be68 commit 56a2c27

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/gui.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,6 +1220,18 @@ impl MyApp {
12201220
egui_logger::logger_ui().show(ui);
12211221
});
12221222

1223+
ctx.input(|i| {
1224+
// Check if files were dropped
1225+
if let Some(dropped_file) = i.raw.dropped_files.last() {
1226+
let path = dropped_file.clone().path.unwrap();
1227+
self.picked_path = path.to_path_buf();
1228+
self.file_opened = true;
1229+
if let Err(e) = self.load_tx.send(self.picked_path.clone()) {
1230+
log::error!("load_tx thread send failed: {:?}", e);
1231+
}
1232+
}
1233+
});
1234+
12231235
match self.file_dialog_state {
12241236
FileDialogState::Open => {
12251237
if let Some(path) = self

0 commit comments

Comments
 (0)