-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Handle global mouse state for Emscripten #12669
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
Conversation
Thanks for giving it a shot! Unfortunately, this doesn't seem to solve the problem. It appears to work at first, but either resizing the browser window or resizing the canvas by changing the window size via In contrast, with my crappy workaround, the position is always consistent even after resizing the browser or the window: Vector2i getPosition(const WindowBase& relativeTo)
{
#ifdef SFML_SYSTEM_EMSCRIPTEN
return getPosition();
#else
return getPosition() - relativeTo.getPosition();
// ^~~~~~~~~~~~~~~~~~~~~~~~
// uses SDL_GetWindowPosition() internally
#endif
} |
Thinking about it a bit more, the issue might now be |
These changes will be merged into #12575. So, closing this PR. |
Please keep them as a separate PR unless there's an actual code dependency between them. |
A test was added to #12575 for verifying multiple windows for Emscripten. This involves spawning multiple windows. To prevent putting them in the same position, I would spawn them at the global position of the mouse. Thus, that branch needed this change. Since this was marked for 3.4.0, I figured it would be fine to merge this branch into that one to have just one PR. |
Merged, thanks! |
Fixes #12667