浏览代码

trigger resize event when going into and out of fullscreen mode

Moros Smith 4 月之前
父节点
当前提交
358917ffc3
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      src/platforms/rcore_web.c

+ 3 - 0
src/platforms/rcore_web.c

@@ -1662,6 +1662,9 @@ static EM_BOOL EmscriptenFullscreenChangeCallback(int eventType, const Emscripte
         }
     }
 
+    // trigger resize event after a brief pause to ensure the canvas exists to resize
+    EM_ASM({ setTimeout(function() { window.dispatchEvent(new Event("resize")); }, 50); });
+
     return 1; // The event was consumed by the callback handler
 }