mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-14 19:26:56 -04:00
Fix #359: web drops land in the document they were dropped on
The web reads dropped files asynchronously, and the place inbox only kept the drop point, so a file dropped on document A was placed into whatever document was active when its bytes arrived. A drop on a canvas now carries place::DropAt (the document's uid, the point, embed), and drop_files makes that document active again before placing; when it has closed meanwhile, nothing is placed and the status bar says so. The native drop path is synchronous and goes through the same code, so it is unchanged in effect. Test: a drop pending while another document opens lands in the first one at the drop point; one whose document closes is not placed anywhere. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
7485dac6e8
commit
accfec7146
5 files changed
+84
-17
No files matched your search
@@ -108,8 +108,8 @@ impl eframe::App for WebShell {
|
||||
match f.bytes_async().await {
|
||||
Ok(bytes) => {
|
||||
match target {
|
||||
DropTarget::Place { at, embed } => {
|
||||
place_inbox.lock().unwrap_or_else(|e| e.into_inner()).push(PlaceArrival { name, bytes, drop: Some((at, embed)) })
|
||||
DropTarget::Place(d) => {
|
||||
place_inbox.lock().unwrap_or_else(|e| e.into_inner()).push(PlaceArrival { name, bytes, drop: Some(d) })
|
||||
}
|
||||
DropTarget::Open => inbox.lock().unwrap_or_else(|e| e.into_inner()).push((name, bytes)),
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user