Browse Source

补点:下一步要把补的点显示出来。

任一存 1 year ago
parent
commit
aa0b0052fc
1 changed files with 37 additions and 9 deletions
  1. 37 9
      src/App.vue

+ 37 - 9
src/App.vue

@@ -260,8 +260,8 @@ export default {
         maxHeight: '',
         minHeight: '',
         isAddingPoint: false,
-        connectionMaxHeightGap: 100,
-        addPointHeight: '',
+        connectionMaxHeightGap: 1,
+        addPointHeight: -1.3,
       }
     }
   },
@@ -399,7 +399,6 @@ export default {
         })
         let zLength = Math.max(...zArray) - Math.min(...zArray)
         let zMin = Math.min(...zArray)
-        this.formData.addPointHeight = zMin + zLength / 2
         let areaRatio = xLength / yLength
 
         // 各个点坐标映射到视口坐标
@@ -792,7 +791,7 @@ export default {
           if (Object.hasOwnProperty.call(neighbourPosList, key)) {
             // 看看这个相邻点位属于上下左右邻居还是斜角邻居。
             let neighbourType = 0
-            if (['posRight', 'posBottom', 'posLeft', 'posTop'].incldes(key)) {
+            if (['posRight', 'posBottom', 'posLeft', 'posTop'].includes(key)) {
               neighbourType = 1
             } else {
               neighbourType = 2
@@ -810,9 +809,9 @@ export default {
               if (matchedPoint) {
                 // 记录自己与其关系。
                 if (neighbourType === 1) {
-                  tempIds1.push(matchedPoint.id)
+                  tempIds1.push(String(matchedPoint.id))
                 } else {
-                  tempIds2.push(matchedPoint.id)
+                  tempIds2.push(String(matchedPoint.id))
                 }
                 // 酌情修改这个外围点位与自己的关系。
 
@@ -857,9 +856,9 @@ export default {
               if (matchedPoint) {
                 // 记录自己与其关系。
                 if (neighbourType === 1) {
-                  tempIds1.push(matchedPoint.id)
+                  tempIds1.push(String(matchedPoint.id))
                 } else {
-                  tempIds2.push(matchedPoint.id)
+                  tempIds2.push(String(matchedPoint.id))
                 }
               }
               // 如果没找到匹配点
@@ -883,9 +882,38 @@ export default {
             }
           }
         } // end of 处理8个相邻点位
+
+        console.assert(tempIds1.length === 4, 'tempIds1长度咋不是4呢?')
+        console.assert(tempIds2.length === 4, 'tempIds1长度咋不是4呢?')
+        tempIds1.sort((a, b) => {
+          if (a === '-1' && b === '-1') {
+            return 0
+          } else if (a === '-1') {
+            return 1
+          } else if (b === '-1') {
+            return -1
+          } else {
+            return 0
+          }
+        })
+        tempIds2.sort((a, b) => {
+          if (a === '-1' && b === '-1') {
+            return 0
+          } else if (a === '-1') {
+            return 1
+          } else if (b === '-1') {
+            return -1
+          } else {
+            return 0
+          }
+        })
+        activePoint.ids = [...tempIds1, ...tempIds2]
+        
         activePointIdx++
       } // end of 依次处理顶点表中各顶点
-    },
+
+      
+    }, // end of method addPoint
   },
 }
 </script>