Speedy2D icon indicating copy to clipboard operation
Speedy2D copied to clipboard

Added drag and drop file support

Open d0rianb opened this issue 3 years ago • 3 comments

I introduce the glutin::event::WindowEvent::{DroppedFile, HoveredFile, HoveredFileCancelled} into speedy2d. I added a new method: on_file_drag to the WindowHandler trait.

d0rianb avatar May 06 '22 16:05 d0rianb

Thank you, and sorry for the delay in reviewing this! It looks good to me, but it needs reformatting using cargo +nightly fmt to pass the CI checks.

It also looks like there are some problems building for WebAssembly, which doesn't use Glutin for windowing.

To run the checks locally, see the "precommit" section of the justfile:

https://github.com/QuantumBadger/Speedy2D/blob/master/justfile

QuantumBadger avatar May 15 '22 15:05 QuantumBadger

I made the changes so the file state is no longer stored in the window helper. This commit pass the CI test except for the build ones (I'm not working on Linux so the automated test aren't working)

d0rianb avatar May 16 '22 09:05 d0rianb

Thanks! I've pushed a commit that fixes the build.

Before I merge this in, I'm going to need to think about how this API will work for WebAssembly in future. In that case we won't have a file "path", but I guess some binary data instead. So before I can integrate this I may need to make it more generic.

QuantumBadger avatar Jun 01 '22 11:06 QuantumBadger