You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In WASM builds of macroquad, when you resize a canvas with JS/CSS on the fly -- it doesn't actually react to that. It is apparent by the graphics rendered in the canvas getting stretched and the fact that width and height attributes of the canvas do not get updated.
This is a problem for
any macroquad app that doesn't have its canvas constantly as "fullscreen"
any macroquad app that may resize its canvas without having the window resized
What is going wrong?
In WASM builds of macroquad, when you resize a canvas with JS/CSS on the fly -- it doesn't actually react to that. It is apparent by the graphics rendered in the canvas getting stretched and the fact that
width
andheight
attributes of the canvas do not get updated.This is a problem for
macroquad
app that doesn't have its canvas constantly as "fullscreen"macroquad
app that may resize its canvas without having the window resizedCause
This might be because, if we look at the miniquad source code (https://github.com/not-fl3/miniquad/blob/master/js/gl.js) the
resize
reoutine is only called whenonresize
event is fired, which according to MDN docs (https://developer.mozilla.org/en-US/docs/Web/API/Window/resize_event) fires off only when the window is resized. Not thecanvas
element.Solution
not-fl3/miniquad#479 seems to have a valid fix as this issue seems to belong to miniquad and not unique to macroquad. The fix uses
ResizeObserver
API (https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver)The text was updated successfully, but these errors were encountered: