Pārlūkot izejas kodu

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

Disallow window.requestAnimationFrame for Babylon Native
Gary Hsu 5 gadi atpakaļ
vecāks
revīzija
39ba620a51
1 mainītis faili ar 2 papildinājumiem un 1 dzēšanām
  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);