diff --git a/src/Add-on/ShareView/ShareViewCameraControl.ts b/src/Add-on/ShareView/ShareViewCameraControl.ts index 3ce531c5e..c53ca0f6c 100644 --- a/src/Add-on/ShareView/ShareViewCameraControl.ts +++ b/src/Add-on/ShareView/ShareViewCameraControl.ts @@ -84,13 +84,16 @@ export class ShareViewCameraControl extends CameraControls { // ShareView中用更改FOV的方式替换原有的透视相机缩放逻辑(CameraControl难以重写) this.Viewer.CameraControl.Fov = clamp(this.Viewer.CameraControl.Fov * scale, this.minFov, this.maxFov); - if (screen.orientation.type.startsWith("portrait")) + if (screen.orientation) { - this.shareViewStore.userFovPortrait = scale; - } - else if (screen.orientation.type.startsWith("landscape")) - { - this.shareViewStore.userFovLandscape = scale; + if (screen.orientation.type.startsWith("portrait")) + { + this.shareViewStore.userFovPortrait = scale; + } + else if (screen.orientation.type.startsWith("landscape")) + { + this.shareViewStore.userFovLandscape = scale; + } } } else diff --git a/src/Add-on/ShareView/components/HouseRoamingButton.tsx b/src/Add-on/ShareView/components/HouseRoamingButton.tsx index e07dff6c9..45e6da9e5 100644 --- a/src/Add-on/ShareView/components/HouseRoamingButton.tsx +++ b/src/Add-on/ShareView/components/HouseRoamingButton.tsx @@ -66,6 +66,7 @@ function HouseRoamingButton() shareViewStore.userFovLandscape = defaultFovLandscape; function initFov() { + if (!screen.orientation) return; if (screen.orientation.type.startsWith("portrait")) shareViewApp.Viewer.CameraCtrl.Fov = shareViewStore.userFovPortrait; else if (screen.orientation.type.startsWith("landscape"))