浏览代码

make sure the event type exists

Raanan Weber 5 年之前
父节点
当前提交
1b422073fa
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/Cameras/Inputs/arcRotateCameraVRDeviceOrientationInput.ts

+ 1 - 1
src/Cameras/Inputs/arcRotateCameraVRDeviceOrientationInput.ts

@@ -69,7 +69,7 @@ export class ArcRotateCameraVRDeviceOrientationInput implements ICameraInput<Arc
 
         if (hostWindow) {
             // check iOS 13+ support
-            if (typeof (<any>DeviceOrientationEvent).requestPermission === 'function') {
+            if (typeof(DeviceMotionEvent) !== "undefined" && typeof (<any>DeviceOrientationEvent).requestPermission === 'function') {
                 (<any>DeviceOrientationEvent).requestPermission()
                     .then((response: string) => {
                         if (response === 'granted') {