From b618d7b35bebc095b16af98a47acfa45f32d6f3d Mon Sep 17 00:00:00 2001 From: Moros Smith Date: Sat, 17 May 2025 21:08:07 -0400 Subject: [PATCH] use parentElement's dimensions for width/height --- src/platforms/rcore_web.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/platforms/rcore_web.c b/src/platforms/rcore_web.c index bf5a6ba5a..cf2ce0065 100644 --- a/src/platforms/rcore_web.c +++ b/src/platforms/rcore_web.c @@ -1681,9 +1681,9 @@ static EM_BOOL EmscriptenResizeCallback(int eventType, const EmscriptenUiEvent * // This event is called whenever the window changes sizes, // so the size of the canvas object is explicitly retrieved below - int width = EM_ASM_INT( return window.innerWidth; ); - int height = EM_ASM_INT( return window.innerHeight; ); - + int width = EM_ASM_INT( return (!!document.fullscreenElement) ? window.innerWidth : Module.canvas.parentElement.clientWidth; ); + int height = EM_ASM_INT( return (!!document.fullscreenElement) ? window.innerHeight : Module.canvas.parentElement.clientHeight; ); + if (width < (int)CORE.Window.screenMin.width) width = CORE.Window.screenMin.width; else if ((width > (int)CORE.Window.screenMax.width) && (CORE.Window.screenMax.width > 0)) width = CORE.Window.screenMax.width;