Parcourir la source

fix: 可以在model间漫游

xzw il y a 1 an
Parent
commit
73ac5bc541

+ 22 - 16
public/lib/potree/potree.js

@@ -34996,7 +34996,8 @@
 	    var easeName = arguments.length > 4 ? arguments[4] : undefined;
 	    var callback = arguments.length > 5 ? arguments[5] : undefined;
 	    //前两个参数有xy即可
-	    endPosition = new Vector3(endPosition.x, endPosition.y, Potree.config.map.cameraHeight);
+	    var z = Math.max(Potree.config.map.cameraHeight, endPosition.z + (boundSize !== null && boundSize !== void 0 && boundSize.z ? boundSize.z / 2 : 0));
+	    endPosition = new Vector3(endPosition.x, endPosition.y, z);
 	    this.view.moveOrthoCamera(this.viewports[0], {
 	      endPosition,
 	      boundSize,
@@ -36133,11 +36134,13 @@
 	          this.temp.sizeFitToLevel[str] = size;
 	        }
 	      } else {
-	        /* let base = 0.007; */var _base = this.material.spacing / Math.pow(2, nodeMaxLevel); //点云大小在level为0时设置为spacing,每长一级,大小就除以2
+	        var _base = 0.015; //2024.8.21 又要求需要不同场景点云大小相同,所以只能固定值了  (正式环境这两个场景 SG-5yxFuWhEMlg SG-XZNyvCDk0jz)
+	        //let base = this.material.spacing / Math.pow(2,  nodeMaxLevel) //在保证最高级别大小刚好的情况下,不改变level降低后的大小
 	        //base的数值理论上应该是右侧算出来的,但发现有的场景nodeMaxLevel和nodeMaxLevelPredict差别较大的点云显示也过大,而直接换成固定值反而可以适应所有场景。该固定值来源于 getHighestNodeSpacing 最小值,修改了下。(会不会是我们的相机其实该值是固定的,根据该值算出的spacing才是有误差的? 如果换了相机是否要改值?)
 	        //2022-12-21又换回非固定值。因为有的场景如SS-t-t01myDqnfE的两个数据集密集程度差别很大,应该将稀疏点云的大小设置的大些。 但是这样的缺点是两个数据集因相接处有大有小无法融合。
-	        size = _base * 20 * num_; /* * window.devicePixelRatio  */
+	        size = _base * 20 * num_;
 	      }
+	      //不同数据集点云最高级别时的间距不同,但不知道如何计算,  级别越高点云越密,spacing越大初始级别越密。 但实际并非2的level次方,底数可能1-2之间
 	    }
 	    //console.log('changePointSize:'  + this.dataset_id + ' , num: ' + (num && num.toPrecision(3)) + ' , size: ' + size.toPrecision(3),  'nodeMaxLevel', nodeMaxLevel.toPrecision(3), 'testMaxNodeCount',this.testMaxNodeCount     /* this.material.spacing */)
 	    if (size) {
@@ -60469,7 +60472,7 @@
 	    var extensions = this.extensions;
 	    var materialDef = json.materials[materialIndex];
 	    if (!materialDef) {
-	      console.error('3dtiles数据有问题'); //add
+	      console.error('gltf材质数据有问题, 可能引起一些列错误'); //add
 	      materialDef = json.materials[0] || {};
 	    }
 	    var materialType;
@@ -75192,7 +75195,7 @@
 	    domElement = document;
 	  }
 	  Object3D.call(this);
-	  this.visible = false;
+	  Potree.Utils.updateVisible(this, 'attach', false);
 	  this.domElement = domElement;
 	  var _gizmo = new TransformControlsGizmo(options);
 	  this.add(_gizmo);
@@ -75338,7 +75341,7 @@
 	  // Set current object
 	  this.attach = function (object) {
 	    this.object = object;
-	    this.visible = true;
+	    Potree.Utils.updateVisible(this, 'attach', true);
 	    //Config.keyCon = false;//add
 	    //this.linesAssistance.setVisible(true)
 	    viewer.dispatchEvent('content_changed');
@@ -75348,10 +75351,9 @@
 	  // Detatch from object
 	  this.detach = function () {
 	    this.object = undefined;
-	    this.visible = false;
 	    this.axis = null;
 	    //Config.keyCon = true;//add
-
+	    Potree.Utils.updateVisible(this, 'attach', false);
 	    //this.linesAssistance.setVisible(false)
 	    viewer.dispatchEvent('content_changed');
 	    return this;
@@ -77027,7 +77029,7 @@
 	    this.boxHelper.quaternion.copy(model.quaternion);
 	  },
 	  showModelOutline(model, state) {
-	    if (Potree.settings.mergeType2 || model ? model.fileType == '3dgs' : this.boxHelper.visible) {
+	    if (Potree.settings.mergeType2 || (model ? model.fileType == '3dgs' : this.boxHelper.visible)) {
 	      //高斯很卡
 	      if (state !== false) {
 	        this.updateBoxHelper(model);
@@ -89820,7 +89822,12 @@
 	      }); //更新viewports相机透视 使focusOnObject在此窗口大小下
 
 	      prisms.forEach(prism => {
-	        points.push(...prism.points);
+	        var prismPoints = prism.points.slice();
+	        if (prism.baseModel) {
+	          var currentBound = prism.baseModel.currentBound || prism.baseModel.boundingBox.clone().applyMatrix4(prism.baseModel.matrixWorld);
+	          prismPoints = prismPoints.map(e => e.clone().setZ(Math.max(e.z, currentBound.max.z)));
+	        }
+	        points.push(...prismPoints);
 	        prism.setSelected(false);
 	        prism.changeStyleForScreenshot(true, {
 	          hideLabel: info.type != 'prism2d-all',
@@ -90006,10 +90013,12 @@
 	        }
 	        if (o.focusBoundCenter) {
 	          boundOri.getCenter(target);
+	          target.z += 1;
 	        }
 	        var boundSizeOri = boundOri.getSize(new Vector3());
-	        var boundSizeMap = boundSizeOri.clone().multiplyScalar(o.boundExpandRatio || math.linearClamp(Math.max(boundSizeOri.x, boundSizeOri.y), [0.5, 30], [2.5, 1.2])); //为了能同时看清测量线和地图,当测量线较短时,扩大margin,防止地图过度放大
-
+	        var expand = o.boundExpandRatio || math.linearClamp(Math.max(boundSizeOri.x, boundSizeOri.y), [0.5, 30], [2.5, 1.2]); //为了能同时看清测量线和地图,当测量线较短时,扩大margin,防止地图过度放大
+	        var boundSizeMap = boundSizeOri.clone();
+	        boundSizeMap.x *= expand, boundSizeMap.y *= expand;
 	        boundSizeMap.x = Math.max(minBound.x, boundSizeMap.x);
 	        boundSizeMap.y = Math.max(minBound.y, boundSizeMap.y);
 	        this.mapViewer.moveTo(target.clone(), boundSizeMap, duration, o.margin, null, done);
@@ -91288,7 +91297,6 @@
 	        gsViewer.start();
 	        gsViewer.splatMesh.updateMatrix();
 	        gsViewer.splatMesh.updateMatrixWorld();
-	        gsViewer.splatMesh.visible = false;
 	        gsViewer.splatMesh.onSplatTreeReadyCallback = () => {
 	          loadDone(gsViewer.splatMesh);
 	          var {
@@ -91319,9 +91327,7 @@
 	        if (e.name == 'scene') {
 	          //gsViewer.selfDrivenUpdate()
 	          gsViewer.update();
-	          if (gsViewer.initialized && gsViewer.splatRenderReady) {
-	            gsViewer.splatMesh.visible = true;
-	          }
+	          if (gsViewer.initialized && gsViewer.splatRenderReady) {}
 	        }
 	      });
 	    }

Fichier diff supprimé car celui-ci est trop grand
+ 1 - 1
public/lib/potree/potree.js.map


+ 94 - 155
public/test-case/model-list-demo.json

@@ -1,111 +1,111 @@
 {
-    "code": 0,
-    "message": "操作成功",
-    "data": [
+  "code": 0,
+  "message": "操作成功",
+  "data": [
         {
             "caseId": null,
-            "fusionNumId": 803,
-            "fusionId": 238,
-            "modelId": 873,
+            "fusionNumId": 1997,
+            "fusionId": 221,
+            "modelId": 1252,
             "hide": 0,
             "transform": {
                 "scale": [
-                    100,
-                    100,
-                    100
+                    100.0,
+                    100.0,
+                    100.0
                 ],
                 "position": {
-                    "x": -45.350823942541645,
-                    "y": -104.43535169063614,
-                    "z": 7.290152971257626
+                    "x": -0.32228,
+                    "y": -0.50493,
+                    "z": 0.0
                 },
                 "rotation": {
                     "x": 0.0,
                     "y": 0.0,
-                    "z": -3.1355273304349445
+                    "z": 0.0
                 }
             },
             "opacity": 100.0,
             "bottom": 0.0,
             "token": null,
             "sceneData": {
-                "modelId": 873,
-                "modelTitle": "港11室外_osgb",
-                "modelDateType": "b3dm",
-                "modelSize": "21.26MB",
-                "type": 3,
+                "modelId": 1252,
+                "modelTitle": null,
+                "modelDateType": "obj",
+                "modelSize": null,
+                "type": 2,
                 "modelObjUrl": null,
-                "modelGlbUrl": "[\"https://4dkk.4dage.com/fusion/test/b3dm/testModel/tileset.json\"]",
-                "userName": "88888888888",
-                "modelType": "b3dm",
-                "num": null,
+                "modelGlbUrl": null,
+                "userName": null,
+                "modelType": "pointcloud",
+                "num": "SS-t-Rv7vsJ0R219",
                 "tbStatus": 0,
                 "createStatus": 1,
-                "createTime": "2024-08-09 15:27:07",
-                "updateTime": "2024-08-09 15:27:13",
-                "deptId": "0",
-                "deptName": "超管组织",
-                "id": null,
-                "buildObjStatus": null,
-                "name": null,
-                "payStatus": null,
+                "createTime": "2024-03-27 14:52:33",
+                "updateTime": "2024-07-17 14:18:53",
+                "deptId": "DEP000011759420653032312832",
+                "deptName": "数据统计总队",
+                "fileNewName": null,
+                "id": 3796,
+                "buildObjStatus": 1,
+                "name": "场景2",
+                "payStatus": 1,
                 "sceneName": null,
-                "snCode": null,
+                "snCode": "A0IA7R137",
                 "status": 2,
-                "thumb": null,
-                "title": null,
-                "viewCount": null,
-                "isLaser": null,
-                "phone": null,
+                "thumb": "https://laser-oss.4dkankan.com/static/img_default/pc.jpg",
+                "title": "场景2",
+                "viewCount": 50,
+                "isLaser": true,
+                "phone": "18819272201",
                 "bind": true,
-                "visible": 0,
-                "location": null
+                "location": 4
             }
         },
         {
             "caseId": null,
-            "fusionNumId": 782,
-            "fusionId": 231,
-            "modelId": 834,
+            "fusionNumId": 1098,
+            "fusionId": 221,
+            "modelId": 1307,
             "hide": 0,
             "transform": {
                 "scale": [
-                    100,
-                    100,
-                    100
+                    100.0,
+                    100.0,
+                    100.0
                 ],
                 "position": {
-                    "x": -22.35873,
-                    "y": -37.39679,
-                    "z": -1.9892550
+                    "x": 0.16552170253057596,
+                    "y": -0.152602403,
+                    "z": 0.10249640482
                 },
                 "rotation": {
-                    "x": 1.5425202,
-                    "y": 1.04879730,
-                    "z": 0.010966
+                    "x": 0.0,
+                    "y": 0.0,
+                    "z": 0.0
                 }
             },
             "opacity": 100.0,
             "bottom": 0.0,
             "token": null,
             "sceneData": {
-                "modelId": 834,
-                "modelTitle": "人_obj",
-                "modelDateType": "obj",
-                "modelSize": "81.05MB",
-                "showInPano": true,
+                "modelId": 1307,
+                "modelTitle": "las",
+                "modelDateType": "las",
+                "modelSize": "5.11MB",
                 "type": 3,
                 "modelObjUrl": null,
-                "modelGlbUrl": "[\"https://4dkk.4dage.com/fusion/prod/model/glb/868/man001.glb\"]",
-                "userName": "13169663387",
-                "modelType": "glb",
+                "modelGlbUrl": "[\"https://4dkk.4dage.com/fusion/xj/model/modelId_1307/webcloud\"]",
+                "userName": "88888888888",
+                "modelType": "las",
                 "num": null,
                 "tbStatus": 0,
                 "createStatus": 1,
-                "createTime": "2024-07-06 12:10:13",
-                "updateTime": "2024-07-06 12:10:40",
-                "deptId": "4",
-                "deptName": "公安部演示小组",
+                "createTime": "2024-07-19 10:52:32",
+                "updateTime": "2024-07-19 10:52:35",
+                "deptId": "0",
+                "deptName": "超管组织",
+                "fileNewName": "https://4dkk.4dage.com/fusion/xj/model/modelId_1307/3af7984d9c1d4cb99998b14a54346008.zip",
                 "id": null,
                 "buildObjStatus": null,
                 "name": null,
@@ -124,9 +124,9 @@
         },
         {
             "caseId": null,
-            "fusionNumId": 778,
-            "fusionId": 231,
-            "modelId": 811,
+            "fusionNumId": 1096,
+            "fusionId": 221,
+            "modelId": 1309,
             "hide": 0,
             "transform": {
                 "scale": [
@@ -135,115 +135,54 @@
                     100.0
                 ],
                 "position": {
-                    "x": -10.44701258911915,
-                    "y": -42.66079106735544,
-                    "z": 9.402257810415175
+                    "x": -0.43192,
+                    "y": -0.28869,
+                    "z": 2.31154
                 },
                 "rotation": {
-                    "x": -1.5707963267948963,
-                    "y": 0.36848723541801,
-                    "z": 3.141592653589793
+                    "x": 1.5708,
+                    "y": 0.0,
+                    "z": 0.0
                 }
             },
             "opacity": 100.0,
             "bottom": 0.0,
             "token": null,
             "sceneData": {
-                "modelId": 811,
-                "modelTitle": "展厅室内_mesh",
+                "modelId": 1309,
+                "modelTitle": null,
                 "modelDateType": "b3dm",
-                "modelSize": "4.55MB",
-                "type": 4,
-                "modelObjUrl": "/home/tomcat/jar-fusion-8808/prod/model/SS-X5apgUqrn4n/mesh.obj",
-                "modelGlbUrl": "[\"https://4dkk.4dage.com/scene_view_data/SS-X5apgUqrn4n/images/3dtiles/tileset.json\"]\r",
+                "modelSize": null,
+                "type": 6,
+                "modelObjUrl": null,
+                "modelGlbUrl": "[\"https://4dkk.4dage.com/scene_view_data/SG-t-D0hJSjOGkfX/images/3dtiles/tileset.json\"]",
                 "userName": null,
                 "modelType": "b3dm",
-                "num": "SS-X5apgUqrn4n",
+                "num": "SG-t-D0hJSjOGkfX",
                 "tbStatus": 0,
                 "createStatus": 1,
-                "createTime": "2022-11-18 17:35:53",
-                "updateTime": "2024-07-08 11:03:26",
-                "deptId": "4",
-                "deptName": "公安部演示小组",
-                "id": 3260229,
+                "createTime": "2024-07-23 17:40:50",
+                "updateTime": "2024-07-23 20:39:46",
+                "deptId": "DEP000011456505791239610368",
+                "deptName": "广州市消防救援支队",
+                "fileNewName": null,
+                "id": 3007940,
                 "buildObjStatus": 0,
-                "name": "展厅室内_mesh",
+                "name": "非文保app拍摄的深光场景",
                 "payStatus": 1,
-                "sceneName": "展厅室内",
-                "snCode": "GABSS0001",
+                "sceneName": "非文保app拍摄的深光场景",
+                "snCode": "BPVT00019",
                 "status": 2,
-                "thumb": "https://4dkk.4dage.com/scene_edit_data/SS-X5apgUqrn4n/user/thumb-1k.jpg",
-                "title": "展厅室内",
-                "viewCount": 49,
+                "thumb": "https://4dkk.4dage.com/scene_view_data/SG-t-D0hJSjOGkfX/images/floor_0.png?t=1721727650730",
+                "title": "非文保app拍摄的深光场景",
+                "viewCount": 7,
                 "isLaser": false,
                 "phone": null,
                 "bind": true,
-                "visible": 1,
                 "location": null
             }
-        },
-        {
-            "caseId": null,
-            "fusionNumId": 805,
-            "fusionId": 240,
-            "modelId": 874,
-            "hide": 0,
-            "transform": {
-                "scale": [
-                    100.0,
-                    100.0,
-                    100.0
-                ],
-                "position": {
-                    "x": 20.092762021549753,
-                    "y": -115.72516108460032,
-                    "z": -1.8091536
-                },
-                "rotation": {
-                    "x": 0.0,
-                    "y": 0.0,
-                    "z": -0.435149718040960
-                }
-            },
-            "opacity": 100.0,
-            "bottom": 0.0,
-            "token": null,
-            "sceneData": {
-                "modelId": 874,
-                "modelTitle": "港11室内_点云",
-                "modelDateType": "obj",
-                "modelSize": null,
-                "type": 5,
-                "modelObjUrl": null,
-                "modelGlbUrl": null,
-                "userName": null,
-                "modelType": "pointcloud",
-                "num": "SG-qA9txZVJEnu",
-                "tbStatus": 0,
-                "createStatus": 1,
-                "createTime": "2024-03-21 12:18:30",
-                "updateTime": "2024-08-09 17:18:39",
-                "deptId": "4",
-                "deptName": "公安部演示小组",
-                "id": 4089,
-                "buildObjStatus": 1,
-                "name": "港11室内_点云",
-                "payStatus": 1,
-                "sceneName": null,
-                "snCode": "GAB000001",
-                "status": 2,
-                "thumb": "https://laser-oss.4dkankan.com/static/img_default/pc.jpg",
-                "title": "MP对比",
-                "viewCount": 38,
-                "isLaser": true,
-                "phone": "18612080104",
-                "bind": true,
-                "prefix": "https://laser.4dkankan.com/backend",
-                "visible": 0,
-                "location": 4
-            }
-        }
-    ],
-    "success": true,
-    "timestamp": 1722393389040
+        } 
+  ],
+  "success": true,
+  "timestamp": 1722216629620
 }

+ 0 - 188
public/test-case/model-list.json

@@ -1,188 +0,0 @@
-{
-  "code": 0,
-  "message": "操作成功",
-  "data": [
-        {
-            "caseId": null,
-            "fusionNumId": 1997,
-            "fusionId": 221,
-            "modelId": 1252,
-            "hide": 0,
-            "transform": {
-                "scale": [
-                    100.0,
-                    100.0,
-                    100.0
-                ],
-                "position": {
-                    "x": -0.32228,
-                    "y": -0.50493,
-                    "z": 0.0
-                },
-                "rotation": {
-                    "x": 0.0,
-                    "y": 0.0,
-                    "z": 0.0
-                }
-            },
-            "opacity": 100.0,
-            "bottom": 0.0,
-            "token": null,
-            "sceneData": {
-                "modelId": 1252,
-                "modelTitle": null,
-                "modelDateType": "obj",
-                "modelSize": null,
-                "type": 2,
-                "modelObjUrl": null,
-                "modelGlbUrl": null,
-                "userName": null,
-                "modelType": "pointcloud",
-                "num": "SS-t-Rv7vsJ0R219",
-                "tbStatus": 0,
-                "createStatus": 1,
-                "createTime": "2024-03-27 14:52:33",
-                "updateTime": "2024-07-17 14:18:53",
-                "deptId": "DEP000011759420653032312832",
-                "deptName": "数据统计总队",
-                "fileNewName": null,
-                "id": 3796,
-                "buildObjStatus": 1,
-                "name": "场景2",
-                "payStatus": 1,
-                "sceneName": null,
-                "snCode": "A0IA7R137",
-                "status": 2,
-                "thumb": "https://laser-oss.4dkankan.com/static/img_default/pc.jpg",
-                "title": "场景2",
-                "viewCount": 50,
-                "isLaser": true,
-                "phone": "18819272201",
-                "bind": true,
-                "location": 4
-            }
-        },
-        {
-            "caseId": null,
-            "fusionNumId": 1098,
-            "fusionId": 221,
-            "modelId": 1307,
-            "hide": 0,
-            "transform": {
-                "scale": [
-                    100.0,
-                    100.0,
-                    100.0
-                ],
-                "position": {
-                    "x": 0.16552170253057596,
-                    "y": -0.152602403,
-                    "z": 0.10249640482
-                },
-                "rotation": {
-                    "x": 0.0,
-                    "y": 0.0,
-                    "z": 0.0
-                }
-            },
-            "opacity": 100.0,
-            "bottom": 0.0,
-            "token": null,
-            "sceneData": {
-                "modelId": 1307,
-                "modelTitle": "las",
-                "modelDateType": "las",
-                "modelSize": "5.11MB",
-                "type": 3,
-                "modelObjUrl": null,
-                "modelGlbUrl": "[\"https://4dkk.4dage.com/fusion/xj/model/modelId_1307/webcloud\"]",
-                "userName": "88888888888",
-                "modelType": "las",
-                "num": null,
-                "tbStatus": 0,
-                "createStatus": 1,
-                "createTime": "2024-07-19 10:52:32",
-                "updateTime": "2024-07-19 10:52:35",
-                "deptId": "0",
-                "deptName": "超管组织",
-                "fileNewName": "https://4dkk.4dage.com/fusion/xj/model/modelId_1307/3af7984d9c1d4cb99998b14a54346008.zip",
-                "id": null,
-                "buildObjStatus": null,
-                "name": null,
-                "payStatus": null,
-                "sceneName": null,
-                "snCode": null,
-                "status": 2,
-                "thumb": null,
-                "title": null,
-                "viewCount": null,
-                "isLaser": null,
-                "phone": null,
-                "bind": true,
-                "location": null
-            }
-        },
-        {
-            "caseId": null,
-            "fusionNumId": 1096,
-            "fusionId": 221,
-            "modelId": 1309,
-            "hide": 0,
-            "transform": {
-                "scale": [
-                    100.0,
-                    100.0,
-                    100.0
-                ],
-                "position": {
-                    "x": -0.43192,
-                    "y": -0.28869,
-                    "z": 2.31154
-                },
-                "rotation": {
-                    "x": 1.5708,
-                    "y": 0.0,
-                    "z": 0.0
-                }
-            },
-            "opacity": 100.0,
-            "bottom": 0.0,
-            "token": null,
-            "sceneData": {
-                "modelId": 1309,
-                "modelTitle": null,
-                "modelDateType": "b3dm",
-                "modelSize": null,
-                "type": 6,
-                "modelObjUrl": null,
-                "modelGlbUrl": "[\"https://4dkk.4dage.com/scene_view_data/SG-t-D0hJSjOGkfX/images/3dtiles/tileset.json\"]",
-                "userName": null,
-                "modelType": "b3dm",
-                "num": "SG-t-D0hJSjOGkfX",
-                "tbStatus": 0,
-                "createStatus": 1,
-                "createTime": "2024-07-23 17:40:50",
-                "updateTime": "2024-07-23 20:39:46",
-                "deptId": "DEP000011456505791239610368",
-                "deptName": "广州市消防救援支队",
-                "fileNewName": null,
-                "id": 3007940,
-                "buildObjStatus": 0,
-                "name": "非文保app拍摄的深光场景",
-                "payStatus": 1,
-                "sceneName": "非文保app拍摄的深光场景",
-                "snCode": "BPVT00019",
-                "status": 2,
-                "thumb": "https://4dkk.4dage.com/scene_view_data/SG-t-D0hJSjOGkfX/images/floor_0.png?t=1721727650730",
-                "title": "非文保app拍摄的深光场景",
-                "viewCount": 7,
-                "isLaser": false,
-                "phone": null,
-                "bind": true,
-                "location": null
-            }
-        } 
-  ],
-  "success": true,
-  "timestamp": 1722216629620
-}

+ 25 - 13
src/sdk/cover/index.js

@@ -34,6 +34,7 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes }) => {
     let { THREE } = Potree.mergeEditStart(dom, mapDom)
     let MergeEditor = viewer.modules.MergeEditor
     Potree.settings.unableNavigate = false
+    Potree.settings.canWalkThroughModel = true
     Potree.settings.showCesium = true
     if (Potree.settings.showCesium) {
 
@@ -74,8 +75,19 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes }) => {
         //lonlat = [113.595236803415,22.3665168584444]//[113.600356,22.364093]
         Potree.setLonlat(lonlat[0], lonlat[1])
     }
-
-
+    if(Potree.settings.canWalkThroughModel){
+        let lastPano 
+        viewer.images360.addEventListener('flyToPano',(e)=>{//漫游到另一个模型就要选中这个模型
+            let model = e.toPano.pano.pointcloud
+            if(lastPano?.pointcloud != model && model != MergeEditor.selected){ 
+                MergeEditor.selectModel(model)
+                model.result_.flyInPano(e.toPano.pano, {dontFly:true})   //切换模型显示,因为flyInPano有事件怕乱所以统一用这个函数            
+            }
+            lastPano = e.toPano.pano
+        })
+        
+    }
+    
 
     viewer.addEventListener('camera_changed', e => {
         var camera = e.viewport.camera
@@ -766,23 +778,24 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes }) => {
                 supportPano() {  //是否支持全景图
                     return model.panos && model.panos.length > 0
                 },
-                flyInPano() {//  飞入全景图
+                flyInPano(pano, {dontFly}={}) {//  飞入全景图
                     requestInPano = model
-                    let pano = viewer.images360.findNearestPano(null, model.panos)
+                    pano = pano || viewer.images360.findNearestPano(null, model.panos)
                     if (pano) {
                         viewer.removeEventListener('camera_changed', camera_changed)
-                        viewer.images360.panos.forEach(pano => {
+                        Potree.settings.canWalkThroughModel || viewer.images360.panos.forEach(pano => {
                             pano.setEnable(pano.pointcloud == model)
                         })
                         viewer.setControls(viewer.fpControls)
-                        MergeEditor.transformControls.detach(model)
+                        //MergeEditor.transformControls.detach(model)
+                        Potree.Utils.updateVisible(MergeEditor.transformControls, 'showPanos', false)
                         Potree.Utils.updateVisible(MergeEditor.boxHelper, 'showPanos', false)
 
                         let changeVisi = (object) => {
                             Potree.Utils.updateVisible(object, 'showPanos', object == model && Potree.settings.modelSkybox || object.showInPano)
                         }
 
-
+                        
                         let eventName = Potree.settings.displayMode != 'showPanos' ? 'endChangeMode' : 'flyToPanoDone'
                         viewer.images360.addEventListener(eventName, (e) => {
                             if (Potree.settings.displayMode == 'showPanos' && requestInPano == model) {
@@ -791,10 +804,9 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes }) => {
                             }
                         }, { once: true })
 
-                        viewer.images360.flyToPano({ pano, canCancelLast: true })
-                        Potree.settings.displayMode = 'showPanos'
-
-
+                        dontFly || viewer.images360.flyToPano({ pano, canCancelLast: true })
+                        Potree.settings.displayMode = 'showPanos' 
+                     
 
                     }
                 },
@@ -806,10 +818,10 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes }) => {
                         Potree.Utils.updateVisible(object, 'showPanos', true)
                     }
                     viewer.objs.children.forEach(changeVisi)
-                    viewer.images360.panos.forEach(pano => {
+                    Potree.settings.canWalkThroughModel || viewer.images360.panos.forEach(pano => {
                         pano.setEnable(true)
                     })
-
+                    Potree.Utils.updateVisible(MergeEditor.transformControls, 'showPanos', true)
                     setTimeout(() => {//在下一帧再变,因为3dtiles需要更新一下才会显示tiles 
                         if (!requestInPano) {
                             Potree.settings.displayMode = 'showPointCloud'