浏览代码

clear observable when camera is disposed

Trevor Baron 6 年之前
父节点
当前提交
8aa4cab54d
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. 5 0
      src/Cameras/Inputs/freeCameraDeviceOrientationInput.ts

+ 5 - 0
src/Cameras/Inputs/freeCameraDeviceOrientationInput.ts

@@ -76,6 +76,11 @@ export class FreeCameraDeviceOrientationInput implements ICameraInput<FreeCamera
         if (this._camera != null && !this._camera.rotationQuaternion) {
             this._camera.rotationQuaternion = new Quaternion();
         }
+        if (this._camera) {
+            this._camera.onDisposeObservable.add(() => {
+                this._onDeviceOrientationChangedObservable.clear();
+            });
+        }
     }
 
     /**