Skip to content
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] Canvas is incorrectly scaled when window size is applied #4464

Open
deathbeam opened this issue Nov 4, 2024 · 4 comments
Open

Comments

@deathbeam
Copy link
Contributor

The deployed example works fine: https://www.raylib.com/examples/core/core_2d_camera_mouse_zoom.html

Latest master (281ee51) behaviour is input gets translated incorrectly and on initial load the canvas is not scaled and positioned incorrectly in bottom-left corner as well. This is because of width: 100% in template that tries to scale the canvas, but this most likely fails to scale the underlying window:

image

See #4455 for original discussion.

Reproduction steps are simply using latest emsdk master, then navigating to raylib src/ directory, running:

make PLATFORM=PLATFORM_WEB -B

then navigating to examples/ directory and running:

make PLATFORM=PLATFORM_WEB -B

and then running:

emrun --port 8080 core/core_2d_camera_mouse_zoom.html
@raysan5
Copy link
Owner

raysan5 commented Nov 4, 2024

@deathbeam thanks for reporting this new issue, I'm reviewing it but I can't find the cause of the issue, even tried reverting to some raylib 5.0 parts but issue also happens! Could it maybe be related to emscripten or some browser change in the way canvas is managed??? I'm a bit lost at the moment... 😢

@Mute124
Copy link
Contributor

Mute124 commented Nov 4, 2024

If you reverted it, then it is probably an issue with emscripten. It could also just be their browser itself.

@raysan5
Copy link
Owner

raysan5 commented Nov 4, 2024

After some investigation, tahnks to raylib Discord community, we found that issue seems related to some change in emscripten. Building with emsdk 3.1.43 it works as expected.

Trying to find at what point the issue was introduced. One potential change reported is on emsdk 3.1.51.

After further testing it was verified that it breaks from 3.1.50 -> 3.1.51

@raysan5
Copy link
Owner

raysan5 commented Nov 4, 2024

@asdqwe thanks for the review, it seems the issue has already been detected on Discord discussion #raylib-dev channel, hopefully findings are being added here by @deathbeam and @michaelfiber

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants