-
Notifications
You must be signed in to change notification settings - Fork 341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Drag&Drop support #1043
Drag&Drop support #1043
Conversation
JS implementation for Drag&Drop
After some more digging turns out SDL does not support ongoing drag&drop operation. I'll keep the ongoing D&D support for potentially future support of it, but right now it'll work only with JS. And for DX getting ongoing drag&drop is also a lot of awkward C++ code that interfaces with winapi so I'm unlikely to implement it and just use |
A few comments :
|
Sure, I based it off JS drag&drop support (but frankly SDL and DX also have a distinction between files and text) and decided to do exhaustive API first. As I mentioned - it's more of a draft that needs feedback (especially since at least SDL support for it have to be merged in HL first anyway).
This one I don't really agree on, since in most cases when I process a drag&drop I would prefer to obtain data immediately instead of introducing extra-continuation method (and awkward context transfer) or lambdas. But since file name is actually the path to the file on sys, it can be removed safely so user can just grab the path and use
Will do.
API was written prior more deeper dig into what data types can be drag/dropped across APIs, hence I went safe route of unknowns. If we treat everything as "file", it can be outright removed anyway.
In JS, DropMove is a separate event and I didn't verify that mouse events are fired properly during the action, on top of that in same JS - it already reports on what data is being dropped. (But that's not the case with SDL, and when DX is implemented - depending on approach it may or may not report it) |
Added hldx/hlsdl support Removed ongoing events (only drop action handled) Removed string/file distinction (now only files are supported) Removed synchronous API Added dropX/dropY fields to drop event Change drop event from interface to abstract
Tested all 3 backends, and everything works properly (JS was a bit finicky with This PR is ready for review/merge. @ncannasse |
Please change DroppedFile.new to be crossplatform, so only the native field is js specific. |
Done. |
A friendly reminder that this PR is still open and ready. :) |
Merged, ty ! |
Resolve #1040
This is a draft implementation of Drag&Drop support with unified API. Needs review and feedback on what can be changed and/or improved. @ncannasse @jefvel
Right now:
API is async by default because JS, but I want to provide synchronous API for sys target (and possibly node).
I didn't event test it yet, as it's just a draft for API, as main implementation details are less important at this point (especially since I'll need to provide implementation of the SDL/DX as a separate PR to HL).