-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Use margin: 0 auto for centering canvas in default emscripten shells #4455
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
deathbeam
commented
Oct 31, 2024
- Instead of using width: 100% for shell.html simply center the canvas. With width: 100% it breaks input when the window do not fits on screen and on some browsers on first load the canvas do not resizes properly (tested on qutebrowser)
- Center canvas on minshell with margin auto instead of leaving it in top left always. I think this is better minimal default and it only repositions the canvas when it fits inside of window, so when it doesnt the original behaviour is preserved
- Instead of using width: 100% for shell.html simply center the canvas. With width: 100% it breaks input when the window do not fits on screen and on some browsers on first load the canvas do not resizes properly (tested on qutebrowser) - Center canvas on minshell with margin auto instead of leaving it in top left always. I think this is better minimal default and it only repositions the canvas when it fits inside of window, so when it doesnt the original behaviour is preserved Signed-off-by: Tomas Slusny <[email protected]>
|
|
@deathbeam @asdqwe Actually, this change is a matter of user preference, one way or another will be better for different use cases. Current styles are used for raylib examples and I set them because I thought it was the best option: Personally, I think current implementation is more attractive with About @deathbeam About the input issues, please, could you be more specific and provide some example? |
|
So for the issues with width: 100%, simply opening some example after building it with default shell causes 2 issues that are reproducible basically every time for me:
As for the minshell change, I think for majority of projects the canvas at least being centered instead of being in top left corner is better default as far as usability goes even when modifying the file is encouraged but the primary reason why I changed that one was because the shell.hmtl did not worked properly because of the issue mentioned above and I wanted to use some reasonable default. So I dont mind splitting the change to 2 separate PRs as well so it can be discussed separately. |
|
@deathbeam I'm afraid I can't reproduce any of the mentioned issues: https://www.raylib.com/examples/core/core_2d_camera_mouse_zoom.html Please, could you provide some example where it can be clearly seen the issue? |
|
I cant reproduce it via link you provided @raysan5 but i can reproduce it when building locally: EDIT: Looks like the link you provided is not master build as its using yellow dot instead of red (or maroon) like in master. Build steps are simply using latest emsdk master, then navigating to raylib make PLATFORM=PLATFORM_WEB -Bthen navigating to make PLATFORM=PLATFORM_WEB -Band then running: emrun --port 8080 core/core_2d_camera_mouse_zoom.html |
|
@deathbeam you are right! building with latest raylib 5.5 gives a wrong display, and it shouldn't! But issue is not the |
|
Yea if it worked before then its probably better to close this and solve the actual issue instead, i will open one for tracking. |
|
#4464 opened here |


