Skip to content

Fix #359: web drops land in the document they were dropped on - #375

Merged
bflatastic merged 1 commit into
mainfrom
fix/issue-359
Oct 7, 2026
Merged

bflatastic merged 1 commit into
mainfrom
fix/issue-359

Conversation

@bflatastic

Copy link
Copy Markdown
Member

On the web, a file dropped on a canvas now lands in the document it was dropped on, even if another document became active while the browser was still reading it.

  • place::DropAt (document uid, drop point, embed) replaces the bare (Point, bool) in DropTarget::Place and PlaceArrival, so the pending drop remembers its document.
  • place::drop_files makes that document active again before placing (dialogs for PDFs, DXF and text then open over it too); if it closed meanwhile, nothing is placed and the status bar says so.
  • The native drop path is synchronous and shares the same code, so its behaviour is unchanged.
  • Test a_file_read_after_another_document_became_active_lands_where_it_was_dropped: a drop pending while another document opens lands in the first one at the drop point, and one whose document closes is placed nowhere (fails without the fix: the image went into the newer document).
  • docs/development.md (web drag-and-drop) and the ROADMAP platforms row mention it.

Checks

  • Rebased on 9ee0c428 (origin/main).
  • cargo fmt --all; cargo clippy -p vectorcraft-ui-egui --all-targets -- -D warnings; cargo clippy -p vectorcraft-web --target wasm32-unknown-unknown -- -D warnings.
  • cargo test -p vectorcraft-ui-egui --lib: 589 passed.
  • cargo xtask layers, cargo xtask brands, cargo xtask wasm: ok.
  • cargo check -p vectorcraft-ui-egui for x86_64-unknown-linux-gnu and aarch64-apple-darwin: ok.
  • Not checked live in a browser (the race needs a held File.arrayBuffer); covered by the headless frame test through the real place inbox.

🤖 Generated with Claude Code

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 <noreply@anthropic.com>
@bflatastic
bflatastic merged commit b5a7994 into main Oct 7, 2026
@bflatastic

Copy link
Copy Markdown
Member Author

Full cargo xtask ci passed on the integrated stack; merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant