Explorar o código

Disallow window.requestAnimationFrame for Babylon Native

Ryan Tremblay %!s(int64=5) %!d(string=hai) anos
pai
achega
21471d1579
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      src/Engines/nativeEngine.ts

+ 2 - 1
src/Engines/nativeEngine.ts

@@ -282,7 +282,8 @@ export class NativeEngine extends Engine {
      * @hidden
      */
     protected _queueNewFrame(bindedRenderFunction: any, requester?: any): number {
-        if (requester.requestAnimationFrame) {
+        // Use the provided requestAnimationFrame, unless the requester is the window. In that case, we will default to the Babylon Native version of requestAnimationFrame.
+        if (requester.requestAnimationFrame && requester !== window) {
             requester.requestAnimationFrame(bindedRenderFunction);
         } else {
             this._native.requestAnimationFrame(bindedRenderFunction);