Browse Source

补的点添加weight和datasetId字段

任一存 1 year ago
parent
commit
1eecebd4e0
2 changed files with 13 additions and 1 deletions
  1. 3 1
      README.md
  2. 10 0
      src/App.vue

+ 3 - 1
README.md

@@ -53,4 +53,6 @@ for 每个当前点
 )
 
 # todo
-save
+history最大条数
+
+多楼层?

+ 10 - 0
src/App.vue

@@ -815,6 +815,14 @@ export default {
         window.alert('请保证:1.框选区域内至少已存在一个点位;2.该点位高度与补点高度之间差距不超过高度差上限。该点位将作为点位生长起点。')
         return
       }
+
+      // 拿到框选区域中已存在点的datasetId(所有点都一样),并计算weight平均值
+      const pointDatasetId = pointInBrushList[0].datasetId
+      let pointWeightSum = 0
+      for (const pointInBrush of pointInBrushList) {
+        pointWeightSum += pointInBrush.weight
+      }
+      const pointWeight = pointWeightSum / pointInBrushList.length
       
       // 开始补点
       let activePointIdx = 0
@@ -922,6 +930,8 @@ export default {
                   x: neiPos.x,
                   y: neiPos.y,
                   z: this.formData.addPointHeight,
+                  datasetId: pointDatasetId,
+                  weight: pointWeight,
                 })
 
                 // 记录自己与其关系