Browse Source

fix: 报错

xzw 1 year ago
parent
commit
2ebb70bfd8
1 changed files with 10 additions and 9 deletions
  1. 10 9
      src/sdk/cover/index.js

+ 10 - 9
src/sdk/cover/index.js

@@ -597,7 +597,12 @@ export const enter = (dom, mapDom, isLocal, lonlat) => {
                     props.rotation = new THREE.Euler().setFromVector3(props.rotation)
                 }
             }
-
+            let getDefaultRotation = ()=>{
+                //0看看,1看见,2深时,3用户上传三维模型,4深时mesh,5深光点云,6深光mesh
+                if(props.fromType == 1 || props.fromType == 4 || props.fromType == 6 ){//来自4dkk的3dtiles初始需要转90度
+                    return new THREE.Euler(Math.PI/2, 0,0)
+                }else return new THREE.Euler(0,0,0)
+            } 
 
 
             if(!props.isFirstLoad){ 
@@ -618,7 +623,7 @@ export const enter = (dom, mapDom, isLocal, lonlat) => {
             }else{
                 readyToAddModel = true 
                  
-                props.rotation = result.getDefaultRotation()
+                props.rotation = getDefaultRotation()
             }
              
             
@@ -735,7 +740,8 @@ export const enter = (dom, mapDom, isLocal, lonlat) => {
             
             let scaleMeasure
             let result = {  
-                bus,
+                bus, 
+                getDefaultRotation,
                 changeShow(show){ 
                     props.show = show  //for autoLoads show model
                     if(model){  
@@ -784,12 +790,7 @@ export const enter = (dom, mapDom, isLocal, lonlat) => {
                     model && model.rotation.setFromVector3(rot) 
                     model && model.dispatchEvent({type:'rotation_changed'})  
                 },
-                getDefaultRotation(){
-                    //0看看,1看见,2深时,3用户上传三维模型,4深时mesh,5深光点云,6深光mesh
-                    if(props.fromType == 1 || props.fromType == 4 || props.fromType == 6 ){//来自4dkk的3dtiles初始需要转90度
-                        return new THREE.Euler(Math.PI/2, 0,0)
-                    }else return new THREE.Euler(0,0,0)
-                },
+                 
                 enterRotateMode(){
                     if(model){
                         if(MergeEditor.split){//分屏校准