Browse Source

fix: 飞就近点

xzw 1 year ago
parent
commit
fed501a3ac
1 changed files with 15 additions and 0 deletions
  1. 15 0
      src/sdk/cover/index.js

+ 15 - 0
src/sdk/cover/index.js

@@ -346,6 +346,20 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes }) => {
 
     let sdk = {
         sceneBus, mapBus,
+        
+        
+        canTurnToPanoMode(pos) { 
+            pos = pos ? new THREE.Vector3().copy(pos) : viewer.images360.position
+
+            let pano = viewer.images360.findNearestPano(pos)
+            if (pano && pano.position.distanceTo(pos) < Potree.config.panoFieldRadius) {
+                return {pano.pointcloud.result_}
+            }
+            //poschange后会调用这个,如果返回false会变为点云模式,且不会自动变回原先的模式
+        },
+        
+        
+        
         getPositionByScreen(pos2d, hopeModelId) {//通过屏幕坐标获取真实坐标 . hopeModelId: 如果指定了模型,优先返回hopeModelId上的intersect
             //console.log('getPositionByScreen',hopeModelId)
             hopeModelId = null
@@ -667,6 +681,7 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes }) => {
             let model
             let done = (model_) => {
                 model = model_
+                model.result_ = result
                 if (!props.isFirstLoad) {
                     model.visible = false//先不显示,防止卡顿
                 }