浏览代码

fix: 不刷新多次运行时全局变量清除

xzw 1 年之前
父节点
当前提交
37967b7dd5
共有 1 个文件被更改,包括 16 次插入1 次删除
  1. 16 1
      service/PanoBoxFrame.js

+ 16 - 1
service/PanoBoxFrame.js

@@ -1287,6 +1287,7 @@ let searchPair = (beginItem, group0_, group1_, parentPairs, resultPairs) => {
 export default class PanoBoxFrame extends THREE.Group {
     constructor(player_, ifAnalyze, dataList) {
         super()
+        this.clear()
         player = player_
         player.model.add(this)
         this.ifAnalyze = ifAnalyze
@@ -1301,7 +1302,7 @@ export default class PanoBoxFrame extends THREE.Group {
         this.add(meshGroup)
 
         this.compute(dataList)
-    }
+    } 
 
     async compute(dataList) {
         startTime = Date.now()
@@ -4054,4 +4055,18 @@ export default class PanoBoxFrame extends THREE.Group {
             lineMaterial.color.set('#efe')
         }
     }
+    
+    
+    clear(){//清除上一次的结果 
+        skyBoxTight = null,
+        meshGroup = null,
+        modelBound = new THREE.Box3(),  
+        groundY = null,  safeBound = null,  boundConfirmed = null,  
+        hue = 0,
+        boxesSolid = []
+    }
+    
+    
+    
+    
 }