mirror of
https://github.com/emilk/egui.git
synced 2026-09-03 07:10:04 -04:00
Simplify file_dialog example
This commit is contained in:
@@ -60,15 +60,19 @@ impl eframe::App for MyApp {
|
||||
}
|
||||
});
|
||||
|
||||
self.detect_files_being_dropped(ctx);
|
||||
preview_files_being_dropped(ctx);
|
||||
|
||||
// Collect dropped files:
|
||||
if !ctx.input().raw.dropped_files.is_empty() {
|
||||
self.dropped_files = ctx.input().raw.dropped_files.clone();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl MyApp {
|
||||
fn detect_files_being_dropped(&mut self, ctx: &egui::Context) {
|
||||
/// Preview hovering files:
|
||||
fn preview_files_being_dropped(ctx: &egui::Context) {
|
||||
use egui::*;
|
||||
|
||||
// Preview hovering files:
|
||||
if !ctx.input().raw.hovered_files.is_empty() {
|
||||
let mut text = "Dropping files:\n".to_owned();
|
||||
for file in &ctx.input().raw.hovered_files {
|
||||
@@ -94,10 +98,4 @@ impl MyApp {
|
||||
Color32::WHITE,
|
||||
);
|
||||
}
|
||||
|
||||
// Collect dropped files:
|
||||
if !ctx.input().raw.dropped_files.is_empty() {
|
||||
self.dropped_files = ctx.input().raw.dropped_files.clone();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user