Selaa lähdekoodia

Merge pull request #8170 from ryantrem/request-animation-frame-fix-for-bn

Disallow window.requestAnimationFrame for Babylon Native
Gary Hsu 5 vuotta sitten
vanhempi
commit
39ba620a51
1 muutettua tiedostoa jossa 2 lisäystä ja 1 poistoa
  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);