任一存 1 year ago
parent
commit
8ea464159e
2 changed files with 29 additions and 16 deletions
  1. 1 1
      README.md
  2. 28 15
      src/App.vue

+ 1 - 1
README.md

@@ -65,6 +65,6 @@ history最大条数
 
 编辑框搞宽点 check
 
-单击点位高亮周围的点,并展示id,并填充补点的高度。
+单击点位高亮周围的点,并展示id,并填充补点的高度。 check
 
 y轴反转

+ 28 - 15
src/App.vue

@@ -313,8 +313,8 @@ export default {
       infoText: '',
       loadingHandler: null,
       formData: {
-        // sceneCode: process.env.NODE_ENV === 'production' ? '' : 'SS-t-XkquhxxurM',
-        sceneCode: process.env.NODE_ENV === 'production' ? '' : 'SS-t-NZUICC2fRLi',
+        sceneCode: process.env.NODE_ENV === 'production' ? '' : 'SS-t-XkquhxxurM',
+        // sceneCode: process.env.NODE_ENV === 'production' ? '' : 'SS-t-NZUICC2fRLi',
         path1: process.env.NODE_ENV === 'production' ? '' : '1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,47,76,101,125',
         path2: '',
         startPoint: process.env.NODE_ENV === 'production' ? '' : '-38.5, 10.8',
@@ -378,6 +378,7 @@ export default {
           return neib.attr('initial-fill')
         })
       }
+      gNode.selectAll('text').remove()
     })
   },
   methods: {
@@ -546,19 +547,6 @@ export default {
           return d[4]
         })
 
-      gNode.selectAll('text').data(wholeDataForRender).enter().append('text')
-      .attr('x', (d) => d[0])
-      .attr('y', (d) => d[1])
-      .attr('font-size', d => pointDistance * pxPerUnitLength / d.length)
-      .attr("text-anchor", "middle")
-      .attr("dominant-baseline", "middle")
-      .attr("fill", "white")
-      .attr('pointer-events', 'none')
-      .text((d) => {
-        return d[d.length - 1]
-      })
-
-        
       gNode.selectAll('rect').on('mouseenter', function(e, d) {
         const id = d[d.length - 1]
         if (id !== activeRect?.datum()[activeRect?.datum().length - 1] && !activeRectNeighbourList?.some((item) => {
@@ -607,6 +595,28 @@ export default {
           })
           activeRectNeighbourList.push(neibNode)
         }
+
+        gNode.selectAll('text').remove()
+        const idTextList = [deepClone(wholeDataForRender[id - 1])]
+        for (const neibId of rawWholeData[id - 1].ids) {
+          if (neibId === '-1') {
+            continue
+          }
+          idTextList.push(wholeDataForRender[Number(neibId) - 1])
+        }
+        gNode.selectAll('text').data(idTextList).enter().append('text')
+          .attr('x', (d) => d[0])
+          .attr('y', (d) => d[1])
+          .attr('font-size', d => pointDistance * pxPerUnitLength / d.length)
+          .attr("text-anchor", "middle")
+          .attr("dominant-baseline", "middle")
+          .attr("fill", "white")
+          .attr('pointer-events', 'none')
+          .text((d) => {
+            return d[d.length - 1]
+          })
+        
+        that.formData.addPointHeight = d[2]
       })
 
       gNode.selectAll('rect').on('dblclick', function(e, d) {
@@ -838,6 +848,7 @@ export default {
         rawWholeData = deepClone(this.rawWholeDataHistory.history[this.rawWholeDataHistory.currentIdx])
         
         gNode.selectAll('rect').remove()
+        gNode.selectAll('text').remove()
         this.renderWholePoints()
       }
     },
@@ -1166,6 +1177,8 @@ export default {
       gNode.selectAll('text').remove()
       this.renderWholePoints()
 
+      gNode.select(`rect[raw-id='${data.id}']`).dispatch('click')
+      
       // 存入历史记录
       if (this.rawWholeDataHistory.currentIdx < this.rawWholeDataHistory.history.length - 1) {
         this.rawWholeDataHistory.history = this.rawWholeDataHistory.history.slice(0, this.rawWholeDataHistory.currentIdx + 1)