Browse Source

bug fix: 补点一次后会激活zoom功能

任一存 1 year ago
parent
commit
af6d2020db
1 changed files with 8 additions and 8 deletions
  1. 8 8
      src/App.vue

+ 8 - 8
src/App.vue

@@ -302,8 +302,15 @@ export default {
     svgNode = d3.select('.svgWrapper').append("svg")
       .attr("width", svgWidth)
       .attr('height', svgHeight)
+      
     gNode = svgNode.append('g')
-    // this.getWholeData()
+
+    zoomObj = d3.zoom().on("zoom", zoomed)
+    svgNode.call(zoomObj);
+
+    brushObj = d3.brush().on("end", (e) => {
+      brushed(e)
+    })
   },
   methods: {
     getInputPathLength(input) {
@@ -468,13 +475,6 @@ export default {
         })
         that.infoText = ''
       })
-
-      zoomObj = d3.zoom().on("zoom", zoomed)
-      svgNode.call(zoomObj);
-
-      brushObj = d3.brush().on("end", (e) => {
-        brushed(e)
-      })
     },
     renderPath() {
       if (!this.formData.path1.trim()) {