-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[rcore] [web] Fix mouse position on resize callback #4738
Conversation
I can confirm that this fixes the mouse cursor issue, but the resizing is still breaking the web page: When the |
Here are the files I use to test this pull request: https://gist.github.com/zet23t/9b98d9f22a20e5c056a374dd4413278b |
Both modes break the original canvas size (or don't restore it properly). |
Well, the changes I did do fix these issues altogether, even though the handling is a bit awkward. |
@asdqwe @zet23t Thank you very much for working on this issue! Please gave me some days to review it properly. I'll try to setup some quick examples to illustrate my use-case. The specific use case I found the issue with was on some of my tools that allow a RESIZABLE window, the canvas covers all the browser window and the tools gets resized responsively with the canvas. Here it is an example: https://www.raylibtech.com/rtexviewer/ Note the main toolbar gets resized with the browser window. This release works as expected because it was build with a previous On the other side, there are the examples that use CSS to set Despite it worked as expected before the HighDPI change, I fear new implementation could not work on both cases... or maybe I'm not properly understanding all the parts involved... I need to review it more carefully. |
Honestly, when I tried to fix the issues I've had, it crossed more than once my mind to bypass GLFW bindings and bind directly to JS using emscripten. This 2nd abstraction layer in between makes this quite a black box what is going on. I don't know though how much work that would be. In the approach I chose, I decided to ignore the GLFW mouse input feedback and use emscripten's callback instead. But yeah, this is quite a mess, unfortunately. |
Completely agree! Also considered it several times! Latest update of Afaik, that's what @ColleagueRiley did for |
@raysan5 Iirc platform_web already implements a lot of the backend on its own. It would still require some work and would force you to maintain an extra layer of Raylib, but it could be worth it. Also for RGFW, I'm thinking about dropping Emscripten callbacks in favor of directly calling the JS callbacks just to be less Emscripten dependent. It would also be nice if I could drop the Emscripten from RGFW entirely, but I don't think that's possible, at least not without A LOT of extra work. |
No description provided.