Skip to content

VectorCraft: An open-source, vector art tool written by scratch in pure Rust

Open dropped SVG paths via the shared reader

David Camposb6625f696470
diff --git a/crates/ui-egui/src/place.rs b/crates/ui-egui/src/place.rs
index 047b28ab5..13e7d9f4e 100644
--- a/crates/ui-egui/src/place.rs
+++ b/crates/ui-egui/src/place.rs
@@ -348,11 +348,14 @@ pub fn drop_files(app: &mut VectorcraftApp, mut files: Vec<(DropTarget, DropFile
p["link"] = json!(!embed);
run(app, &p).map(|_| ())
}
- DropTarget::Open => io::open_bytes(app, &name, &bytes, path.clone()).map(|_| {
- if let Some(path) = &path {
- io::note_recent(app, path);
- }
- }),
+ DropTarget::Open => match path.as_deref() {
+ Some(path) if app.services.read.is_some() => io::open_path(app, path).map(|_| ()),
+ _ => io::open_bytes(app, &name, &bytes, path.clone()).map(|_| {
+ if let Some(path) = &path {
+ io::note_recent(app, path);
+ }
+ }),
+ },
};
if let Err(e) = r {
app.status(if target == DropTarget::Open { format!("Couldn't open {name}: {e}") } else { format!("Couldn't place {name}: {e}") });