Просмотр исходного кода

修复bug:http://192.168.0.21/index.php?m=bug&f=view&bugID=41006

xushiting 1 год назад
Родитель
Сommit
74e03e7c7f
2 измененных файлов с 776 добавлено и 203 удалено
  1. 362 110
      src/graphic/Layer.js
  2. 414 93
      src/graphic/ListenLayer.js

+ 362 - 110
src/graphic/Layer.js

@@ -159,7 +159,11 @@ export default class Layer {
         stateService.setEventName(LayerEvents.MovePoint);
         const newPoint = addPoint.buildPoint(position);
         if (newPoint) {
-          stateService.setSelectItem(newPoint.vectorId, VectorType.Point, SelectState.Select);
+          stateService.setSelectItem(
+            newPoint.vectorId,
+            VectorType.Point,
+            SelectState.Select
+          );
           this.renderer.autoRedraw();
         }
         break;
@@ -171,7 +175,11 @@ export default class Layer {
       case LayerEvents.AddText:
         stateService.setEventName(LayerEvents.MoveText);
         addText.buildText(position);
-        stateService.setSelectItem(addText.newText.vectorId, VectorType.Text, SelectState.Select);
+        stateService.setSelectItem(
+          addText.newText.vectorId,
+          VectorType.Text,
+          SelectState.Select
+        );
         addText.clear();
         break;
       case LayerEvents.AddSVG:
@@ -185,7 +193,11 @@ export default class Layer {
       case LayerEvents.AddMagnifier:
         stateService.setEventName(LayerEvents.MoveMagnifier);
         addMagnifier.buildMagnifier(position);
-        stateService.setSelectItem(addMagnifier.newMagnifier.vectorId, VectorType.Magnifier, SelectState.Select);
+        stateService.setSelectItem(
+          addMagnifier.newMagnifier.vectorId,
+          VectorType.Magnifier,
+          SelectState.Select
+        );
         addMagnifier.clear();
         break;
       case VectorEvents.AddLane:
@@ -196,9 +208,17 @@ export default class Layer {
             selectAddLaneFlag = true;
             let roadLanCount = road.getLanesCount(selectItem.dir);
             if (selectItem.dir == "left") {
-              roadService.updateForAddSubtractLanesCount(road.vectorId, roadLanCount + 1, selectItem.dir);
+              roadService.updateForAddSubtractLanesCount(
+                road.vectorId,
+                roadLanCount + 1,
+                selectItem.dir
+              );
             } else {
-              roadService.updateForAddSubtractLanesCount(road.vectorId, roadLanCount + 1, selectItem.dir);
+              roadService.updateForAddSubtractLanesCount(
+                road.vectorId,
+                roadLanCount + 1,
+                selectItem.dir
+              );
             }
             roadService.initRoadWidthTipsPos(road);
 
@@ -216,9 +236,17 @@ export default class Layer {
               selectAddLaneFlag = true;
               let curveRoadLanCount = road.getLanesCount(selectItem.dir);
               if (selectItem.dir == "left") {
-                curveRoadService.updateForAddSubtractLanesCount(road.vectorId, curveRoadLanCount + 1, selectItem.dir);
+                curveRoadService.updateForAddSubtractLanesCount(
+                  road.vectorId,
+                  curveRoadLanCount + 1,
+                  selectItem.dir
+                );
               } else {
-                curveRoadService.updateForAddSubtractLanesCount(road.vectorId, curveRoadLanCount + 1, selectItem.dir);
+                curveRoadService.updateForAddSubtractLanesCount(
+                  road.vectorId,
+                  curveRoadLanCount + 1,
+                  selectItem.dir
+                );
               }
               let leftEdge = dataService.getCurveRoadEdge(road.leftEdgeId);
               let rightEdge = dataService.getCurveRoadEdge(road.rightEdgeId);
@@ -246,9 +274,17 @@ export default class Layer {
             selectDelLaneFlag = true;
             let roadLanCount = road.getLanesCount(selectItem.dir);
             if (selectItem.dir == "left") {
-              roadService.updateForAddSubtractLanesCount(road.vectorId, roadLanCount - 1, selectItem.dir);
+              roadService.updateForAddSubtractLanesCount(
+                road.vectorId,
+                roadLanCount - 1,
+                selectItem.dir
+              );
             } else {
-              roadService.updateForAddSubtractLanesCount(road.vectorId, roadLanCount - 1, selectItem.dir);
+              roadService.updateForAddSubtractLanesCount(
+                road.vectorId,
+                roadLanCount - 1,
+                selectItem.dir
+              );
             }
             let leftEdge = dataService.getRoadEdge(road.leftEdgeId);
             let rightEdge = dataService.getRoadEdge(road.rightEdgeId);
@@ -265,9 +301,17 @@ export default class Layer {
               selectDelLaneFlag = true;
               let curveRoadLanCount = road.getLanesCount(selectItem.dir);
               if (selectItem.dir == "left") {
-                curveRoadService.updateForAddSubtractLanesCount(road.vectorId, curveRoadLanCount - 1, selectItem.dir);
+                curveRoadService.updateForAddSubtractLanesCount(
+                  road.vectorId,
+                  curveRoadLanCount - 1,
+                  selectItem.dir
+                );
               } else {
-                curveRoadService.updateForAddSubtractLanesCount(road.vectorId, curveRoadLanCount - 1, selectItem.dir);
+                curveRoadService.updateForAddSubtractLanesCount(
+                  road.vectorId,
+                  curveRoadLanCount - 1,
+                  selectItem.dir
+                );
               }
               let leftEdge = dataService.getCurveRoadEdge(road.leftEdgeId);
               let rightEdge = dataService.getCurveRoadEdge(road.rightEdgeId);
@@ -292,12 +336,18 @@ export default class Layer {
         if (focusItem && focusItem.vectorId) {
           if (focusItem.type == VectorType.CurveRoad) {
             const curveRoad = dataService.getCurveRoad(focusItem.vectorId);
-            let index = mathUtil.getIndexForCurvesPoints(position, curveRoad.points);
+            let index = mathUtil.getIndexForCurvesPoints(
+              position,
+              curveRoad.points
+            );
             if (index != -1) {
               curveRoadService.addCPoint(curveRoad, position, index);
             } else {
               const dis1 = mathUtil.getDistance(curveRoad.points[0], position);
-              const dis2 = mathUtil.getDistance(curveRoad.points[curveRoad.points.length - 1], position);
+              const dis2 = mathUtil.getDistance(
+                curveRoad.points[curveRoad.points.length - 1],
+                position
+              );
               if (dis1 > dis2) {
                 index = curveRoad.points.length - 2;
               } else {
@@ -324,12 +374,18 @@ export default class Layer {
             curveLine.setStyle(style);
           } else if (focusItem.type == VectorType.CurveLine) {
             let curveLine = dataService.getCurveLine(focusItem.vectorId);
-            let index = mathUtil.getIndexForCurvesPoints(position, curveLine.points);
+            let index = mathUtil.getIndexForCurvesPoints(
+              position,
+              curveLine.points
+            );
             if (index != -1) {
               lineService.addCPoint(position, index, focusItem.vectorId);
             } else {
               const dis1 = mathUtil.getDistance(curveLine.points[0], position);
-              const dis2 = mathUtil.getDistance(curveLine.points[curveLine.points.length - 1], position);
+              const dis2 = mathUtil.getDistance(
+                curveLine.points[curveLine.points.length - 1],
+                position
+              );
               if (dis1 > dis2) {
                 index = curveLine.points.length - 2;
               } else {
@@ -363,7 +419,11 @@ export default class Layer {
     selectItem = stateService.getSelectItem();
     stateService.setDraggingItem(selectItem);
     stateService.clearFocusItem();
-    if (selectItem && this.uiControl.focusVector && selectItem.vectorId == this.uiControl.focusVector.vectorId) {
+    if (
+      selectItem &&
+      this.uiControl.focusVector &&
+      selectItem.vectorId == this.uiControl.focusVector.vectorId
+    ) {
     } else {
       this.uiControl.clearFocusVector();
     }
@@ -428,14 +488,24 @@ export default class Layer {
       y: position.y,
     };
     const eventName = stateService.getEventName();
-    if (!this.dragging && Math.abs(X - this.startX) < minDragDis && Math.abs(Y - this.startY) < minDragDis) {
+    if (
+      !this.dragging &&
+      Math.abs(X - this.startX) < minDragDis &&
+      Math.abs(Y - this.startY) < minDragDis
+    ) {
       return;
     }
     this.dragging = true;
-    if (Math.abs(X - this.startX) > minDragDis || Math.abs(Y - this.startY) > minDragDis) {
+    if (
+      Math.abs(X - this.startX) > minDragDis ||
+      Math.abs(Y - this.startY) > minDragDis
+    ) {
       // 是否拖拽了
       if (eventName != null) {
-        if (eventName == LayerEvents.MoveMagnifier && stateService.getSelectItem().state != 0) {
+        if (
+          eventName == LayerEvents.MoveMagnifier &&
+          stateService.getSelectItem().state != 0
+        ) {
         } else {
           stateService.clearFocusItem();
           this.uiControl.clearFocusVector();
@@ -462,8 +532,10 @@ export default class Layer {
       case LayerEvents.PanBackGround:
         stateService.clearItems();
         let center = {};
-        center.x = coordinate.center.x - (dx * coordinate.defaultZoom) / coordinate.zoom;
-        center.y = coordinate.center.y + (dy * coordinate.defaultZoom) / coordinate.zoom;
+        center.x =
+          coordinate.center.x - (dx * coordinate.defaultZoom) / coordinate.zoom;
+        center.y =
+          coordinate.center.y + (dy * coordinate.defaultZoom) / coordinate.zoom;
         let tempCenter = {};
         mathUtil.clonePoint(tempCenter, coordinate.center);
         mathUtil.clonePoint(coordinate.center, center);
@@ -477,8 +549,11 @@ export default class Layer {
         break;
       case LayerEvents.AddRoad:
         needAutoRedraw = true;
-        listenLayer.start(position);
-        if (listenLayer.modifyPoint && listenLayer.modifyPoint.hasOwnProperty("x")) {
+        listenLayer.start(position, null, VectorType.Road);
+        if (
+          listenLayer.modifyPoint &&
+          listenLayer.modifyPoint.hasOwnProperty("x")
+        ) {
           position = {
             x: listenLayer.modifyPoint.x,
             y: listenLayer.modifyPoint.y,
@@ -492,8 +567,11 @@ export default class Layer {
         break;
       case LayerEvents.AddLine:
         needAutoRedraw = true;
-        listenLayer.start(position);
-        if (listenLayer.modifyPoint && listenLayer.modifyPoint.hasOwnProperty("x")) {
+        listenLayer.start(position, null, VectorType.Line);
+        if (
+          listenLayer.modifyPoint &&
+          listenLayer.modifyPoint.hasOwnProperty("x")
+        ) {
           position = {
             x: listenLayer.modifyPoint.x,
             y: listenLayer.modifyPoint.y,
@@ -506,8 +584,11 @@ export default class Layer {
         break;
       case LayerEvents.AddCurveLine:
         needAutoRedraw = true;
-        listenLayer.start(position);
-        if (listenLayer.modifyPoint && listenLayer.modifyPoint.hasOwnProperty("x")) {
+        listenLayer.start(position, null, VectorType.CurveLine);
+        if (
+          listenLayer.modifyPoint &&
+          listenLayer.modifyPoint.hasOwnProperty("x")
+        ) {
           position = {
             x: listenLayer.modifyPoint.x,
             y: listenLayer.modifyPoint.y,
@@ -521,7 +602,10 @@ export default class Layer {
       case LayerEvents.AddCircle:
         needAutoRedraw = true;
         listenLayer.start(position);
-        if (listenLayer.modifyPoint && listenLayer.modifyPoint.hasOwnProperty("x")) {
+        if (
+          listenLayer.modifyPoint &&
+          listenLayer.modifyPoint.hasOwnProperty("x")
+        ) {
           position = {
             x: listenLayer.modifyPoint.x,
             y: listenLayer.modifyPoint.y,
@@ -534,15 +618,17 @@ export default class Layer {
         break;
       case LayerEvents.AddingRoad:
         needAutoRedraw = true;
-        listenLayer.start(position);
-
+        listenLayer.start(position, null, VectorType.Road);
         // listenLayer.start(position, {
         //   exceptLineId: exceptLineId,
         //   exceptPointId: exceptPointId,
         //   addRoad.startInfo.linkedRoadId
         //   addRoad.startInfo.linkedRoadPointId
         // });
-        if (listenLayer.modifyPoint && listenLayer.modifyPoint.hasOwnProperty("x")) {
+        if (
+          listenLayer.modifyPoint &&
+          listenLayer.modifyPoint.hasOwnProperty("x")
+        ) {
           position = {
             x: listenLayer.modifyPoint.x,
             y: listenLayer.modifyPoint.y,
@@ -579,12 +665,19 @@ export default class Layer {
             exceptLineId = exceptPoint.getParent();
           }
         }
-        listenLayer.start(position, {
-          //exceptLineId: exceptLineId,
-          exceptLineIds: exceptLineId,
-          exceptPointId: exceptPointId,
-        });
-        if (listenLayer.modifyPoint && listenLayer.modifyPoint.hasOwnProperty("x")) {
+        listenLayer.start(
+          position,
+          {
+            //exceptLineId: exceptLineId,
+            exceptLineIds: exceptLineId,
+            exceptPointId: exceptPointId,
+          },
+          VectorType.Line
+        );
+        if (
+          listenLayer.modifyPoint &&
+          listenLayer.modifyPoint.hasOwnProperty("x")
+        ) {
           position = {
             x: listenLayer.modifyPoint.x,
             y: listenLayer.modifyPoint.y,
@@ -610,11 +703,18 @@ export default class Layer {
           exceptCurveLineId = addLine.newLine.vectorId;
           exceptCurvePointId = addLine.newLine.endId;
         }
-        listenLayer.start(position, {
-          exceptCurveLineId: exceptCurveLineId,
-          exceptCurvePointId: exceptCurvePointId,
-        });
-        if (listenLayer.modifyPoint && listenLayer.modifyPoint.hasOwnProperty("x")) {
+        listenLayer.start(
+          position,
+          {
+            exceptCurveLineId: exceptCurveLineId,
+            exceptCurvePointId: exceptCurvePointId,
+          },
+          VectorType.CurveLine
+        );
+        if (
+          listenLayer.modifyPoint &&
+          listenLayer.modifyPoint.hasOwnProperty("x")
+        ) {
           position = {
             x: listenLayer.modifyPoint.x,
             y: listenLayer.modifyPoint.y,
@@ -639,7 +739,10 @@ export default class Layer {
           exceptCircleId = addCircle.newCircle.vectorId;
         }
         listenLayer.start(position, { exceptCircleId: exceptCircleId });
-        if (listenLayer.modifyPoint && listenLayer.modifyPoint.hasOwnProperty("x")) {
+        if (
+          listenLayer.modifyPoint &&
+          listenLayer.modifyPoint.hasOwnProperty("x")
+        ) {
           position = {
             x: listenLayer.modifyPoint.x,
             y: listenLayer.modifyPoint.y,
@@ -661,17 +764,28 @@ export default class Layer {
         let road = dataService.getRoad(draggingItem.vectorId);
         let start = dataService.getRoadPoint(road.startId);
         let end = dataService.getRoadPoint(road.endId);
-        if (Object.keys(start.getParent()).length == 1 && Object.keys(end.getParent()).length == 1) {
+        if (
+          Object.keys(start.getParent()).length == 1 &&
+          Object.keys(end.getParent()).length == 1
+        ) {
           //拖拽的路只有一条
-          moveRoad.moveRoad(draggingItem.vectorId, (dx * coordinate.defaultZoom) / coordinate.zoom, (dy * coordinate.defaultZoom) / coordinate.zoom);
+          moveRoad.moveRoad(
+            draggingItem.vectorId,
+            (dx * coordinate.defaultZoom) / coordinate.zoom,
+            (dy * coordinate.defaultZoom) / coordinate.zoom
+          );
         }
         break;
       case LayerEvents.MoveRoadPoint:
         point = dataService.getRoadPoint(draggingItem.vectorId);
-        listenLayer.start(position, {
-          exceptRoadPointId: draggingItem.vectorId,
-          exceptRoadIds: point.parent,
-        });
+        listenLayer.start(
+          position,
+          {
+            exceptRoadPointId: draggingItem.vectorId,
+            exceptRoadIds: point.parent,
+          },
+          VectorType.Road
+        );
         if (
           listenLayer.modifyPoint &&
           (listenLayer.modifyPoint.linkedRoadPointId ||
@@ -688,7 +802,11 @@ export default class Layer {
           listenLayer.modifyPoint = null;
         }
 
-        let flag = moveRoad.moveingRoadPoint(draggingItem.vectorId, position, listenLayer.modifyPoint);
+        let flag = moveRoad.moveingRoadPoint(
+          draggingItem.vectorId,
+          position,
+          listenLayer.modifyPoint
+        );
         if (!flag) {
           elementService.hideAll();
         } else {
@@ -698,8 +816,11 @@ export default class Layer {
         break;
       case LayerEvents.AddCurveRoad:
         needAutoRedraw = true;
-        listenLayer.start(position);
-        if (listenLayer.modifyPoint && listenLayer.modifyPoint.hasOwnProperty("x")) {
+        listenLayer.start(position, null, VectorType.CurveRoad);
+        if (
+          listenLayer.modifyPoint &&
+          listenLayer.modifyPoint.hasOwnProperty("x")
+        ) {
           position = {
             x: listenLayer.modifyPoint.x,
             y: listenLayer.modifyPoint.y,
@@ -712,8 +833,11 @@ export default class Layer {
         break;
       case LayerEvents.AddingCurveRoad:
         needAutoRedraw = true;
-        listenLayer.start(position);
-        if (listenLayer.modifyPoint && listenLayer.modifyPoint.hasOwnProperty("x")) {
+        listenLayer.start(position, null, VectorType.CurveRoad);
+        if (
+          listenLayer.modifyPoint &&
+          listenLayer.modifyPoint.hasOwnProperty("x")
+        ) {
           position = {
             x: listenLayer.modifyPoint.x,
             y: listenLayer.modifyPoint.y,
@@ -736,17 +860,25 @@ export default class Layer {
         break;
       case LayerEvents.MoveCurveRoad:
         needAutoRedraw = true;
-        moveRoad.moveCurveRoad(draggingItem.vectorId, (dx * coordinate.defaultZoom) / coordinate.zoom, (dy * coordinate.defaultZoom) / coordinate.zoom);
+        moveRoad.moveCurveRoad(
+          draggingItem.vectorId,
+          (dx * coordinate.defaultZoom) / coordinate.zoom,
+          (dy * coordinate.defaultZoom) / coordinate.zoom
+        );
         break;
       case LayerEvents.MoveCurveRoadPoint:
         if (!draggingItem || !draggingItem.vectorId) {
           return;
         }
         point = dataService.getCurveRoadPoint(draggingItem.vectorId);
-        listenLayer.start(position, {
-          exceptCurveRoadPointId: draggingItem.vectorId,
-          exceptCurveRoadId: point.parent, //不会融合,所以parent只有一个
-        });
+        listenLayer.start(
+          position,
+          {
+            exceptCurveRoadPointId: draggingItem.vectorId,
+            exceptCurveRoadId: point.parent, //不会融合,所以parent只有一个
+          },
+          VectorType.CurveRoad
+        );
         if (
           listenLayer.modifyPoint &&
           (listenLayer.modifyPoint.linkedCurveRoadPointId ||
@@ -780,13 +912,21 @@ export default class Layer {
         break;
       case LayerEvents.MoveCurveEdge:
         if (listenLayer.modifyPoint) {
-          moveRoad.moveCurveEdge(draggingItem.vectorId, listenLayer.modifyPoint.selectIndex, position);
+          moveRoad.moveCurveEdge(
+            draggingItem.vectorId,
+            listenLayer.modifyPoint.selectIndex,
+            position
+          );
         }
         needAutoRedraw = true;
         break;
       case LayerEvents.MoveLine:
         if (draggingItem != null) {
-          let flag = moveLine.moveLine(draggingItem.vectorId, (dx * coordinate.defaultZoom) / coordinate.zoom, (dy * coordinate.defaultZoom) / coordinate.zoom);
+          let flag = moveLine.moveLine(
+            draggingItem.vectorId,
+            (dx * coordinate.defaultZoom) / coordinate.zoom,
+            (dy * coordinate.defaultZoom) / coordinate.zoom
+          );
           if (!flag) {
             this.lastX = this.lastX - dx / coordinate.ratio;
             this.lastY = this.lastY - dy / coordinate.ratio;
@@ -797,18 +937,29 @@ export default class Layer {
       case LayerEvents.MovePoint:
         if (draggingItem != null) {
           point = dataService.getPoint(draggingItem.vectorId);
-          listenLayer.start(position, {
-            exceptPointId: draggingItem.vectorId,
-            exceptLineIds: point.parent,
-          });
+          listenLayer.start(
+            position,
+            {
+              exceptPointId: draggingItem.vectorId,
+              exceptLineIds: point.parent,
+            },
+            VectorType.Line
+          );
 
-          if (listenLayer.modifyPoint && listenLayer.modifyPoint.x && listenLayer.modifyPoint.y) {
+          if (
+            listenLayer.modifyPoint &&
+            listenLayer.modifyPoint.x &&
+            listenLayer.modifyPoint.y
+          ) {
             position = {
               x: listenLayer.modifyPoint.x,
               y: listenLayer.modifyPoint.y,
             };
           }
-          let movePointFlag = movePoint.movePoint(position, draggingItem.vectorId);
+          let movePointFlag = movePoint.movePoint(
+            position,
+            draggingItem.vectorId
+          );
           needAutoRedraw = true;
           if (!point) {
             stateService.clearEventName();
@@ -820,11 +971,18 @@ export default class Layer {
       case LayerEvents.MoveCurvePoint:
         if (draggingItem != null) {
           let curvePoint = dataService.getCurvePoint(draggingItem.vectorId);
-          listenLayer.start(position, {
-            exceptCurvePointId: draggingItem.vectorId,
-            exceptCurveLineId: curvePoint.parent,
-          });
-          if (listenLayer.modifyPoint && listenLayer.modifyPoint.hasOwnProperty("x")) {
+          listenLayer.start(
+            position,
+            {
+              exceptCurvePointId: draggingItem.vectorId,
+              exceptCurveLineId: curvePoint.parent,
+            },
+            VectorType.CurveLine
+          );
+          if (
+            listenLayer.modifyPoint &&
+            listenLayer.modifyPoint.hasOwnProperty("x")
+          ) {
             position = {
               x: listenLayer.modifyPoint.x,
               y: listenLayer.modifyPoint.y,
@@ -839,16 +997,33 @@ export default class Layer {
         break;
       case LayerEvents.MoveCurveLine:
         if (draggingItem != null) {
-          moveLine.moveCurveLine(draggingItem.vectorId, (dx * coordinate.defaultZoom) / coordinate.zoom, (dy * coordinate.defaultZoom) / coordinate.zoom);
+          moveLine.moveCurveLine(
+            draggingItem.vectorId,
+            (dx * coordinate.defaultZoom) / coordinate.zoom,
+            (dy * coordinate.defaultZoom) / coordinate.zoom
+          );
           needAutoRedraw = true;
         }
         break;
       case LayerEvents.MoveCircle:
         if (draggingItem != null) {
           if (draggingItem.state == -1) {
-            moveCircle.moveFull(draggingItem.vectorId, (dx * coordinate.defaultZoom) / coordinate.zoom, (dy * coordinate.defaultZoom) / coordinate.zoom);
-          } else if (draggingItem.state == 0 || draggingItem.state == 1 || draggingItem.state == 2 || draggingItem.state == 3) {
-            moveCircle.movePoint(position, draggingItem.vectorId, draggingItem.state);
+            moveCircle.moveFull(
+              draggingItem.vectorId,
+              (dx * coordinate.defaultZoom) / coordinate.zoom,
+              (dy * coordinate.defaultZoom) / coordinate.zoom
+            );
+          } else if (
+            draggingItem.state == 0 ||
+            draggingItem.state == 1 ||
+            draggingItem.state == 2 ||
+            draggingItem.state == 3
+          ) {
+            moveCircle.movePoint(
+              position,
+              draggingItem.vectorId,
+              draggingItem.state
+            );
           } else {
             debugger;
           }
@@ -872,14 +1047,22 @@ export default class Layer {
           if (draggingItem.state == -1) {
             moveSVG.moveFullSVG(position, draggingItem.vectorId);
           } else {
-            moveSVG.movePoint(position, draggingItem.vectorId, draggingItem.state);
+            moveSVG.movePoint(
+              position,
+              draggingItem.vectorId,
+              draggingItem.state
+            );
           }
         }
         break;
       case LayerEvents.MoveMagnifier:
         needAutoRedraw = true;
         if (draggingItem != null) {
-          moveMagnifier.moveFullMagnifier(position, draggingItem.vectorId, draggingItem.state);
+          moveMagnifier.moveFullMagnifier(
+            position,
+            draggingItem.vectorId,
+            draggingItem.state
+          );
         }
         break;
     }
@@ -956,10 +1139,14 @@ export default class Layer {
         elementService.hideAll();
         let point = dataService.getRoadPoint(draggingItem.vectorId);
         if (point) {
-          listenLayer.start(point, {
-            exceptRoadPointId: draggingItem.vectorId,
-            exceptRoadIds: point.parent,
-          });
+          listenLayer.start(
+            point,
+            {
+              exceptRoadPointId: draggingItem.vectorId,
+              exceptRoadIds: point.parent,
+            },
+            VectorType.Road
+          );
 
           moveRoad.finishByMoveRoadPoint(point);
           this.history.save();
@@ -982,8 +1169,6 @@ export default class Layer {
           }
         }
 
-     
-
         this.uiControl.confirmEntry(); //不能连续创建道路
         break;
       case LayerEvents.AddingLine:
@@ -991,7 +1176,10 @@ export default class Layer {
         addLine.finish(position);
         this.updateForLocation();
         //绘制的是基准线
-        if (addLine.newLine && Settings.baseLineId == addLine.newLine.vectorId) {
+        if (
+          addLine.newLine &&
+          Settings.baseLineId == addLine.newLine.vectorId
+        ) {
           stateService.clearEventName();
           this.history.save();
         }
@@ -1053,11 +1241,24 @@ export default class Layer {
         break;
       case LayerEvents.MoveCurveRoadPoint:
         needAutoRedraw = true;
-        if (listenLayer.modifyPoint && listenLayer.modifyPoint.linkedCurveRoadPointId) {
-          let curveRoadPoint1 = dataService.getCurveRoadPoint(listenLayer.modifyPoint.linkedCurveRoadPointId);
-          let curveRoadPoint2 = dataService.getCurveRoadPoint(draggingItem.vectorId);
-          if (listenLayer.modifyPoint.linkedCurveRoadPointId != draggingItem.vectorId && curveRoadPoint1.getParent() == curveRoadPoint2.getParent()) {
-            curveRoadPointService.deleteCurveRoadPoint(listenLayer.modifyPoint.linkedCurveRoadPointId);
+        if (
+          listenLayer.modifyPoint &&
+          listenLayer.modifyPoint.linkedCurveRoadPointId
+        ) {
+          let curveRoadPoint1 = dataService.getCurveRoadPoint(
+            listenLayer.modifyPoint.linkedCurveRoadPointId
+          );
+          let curveRoadPoint2 = dataService.getCurveRoadPoint(
+            draggingItem.vectorId
+          );
+          if (
+            listenLayer.modifyPoint.linkedCurveRoadPointId !=
+              draggingItem.vectorId &&
+            curveRoadPoint1.getParent() == curveRoadPoint2.getParent()
+          ) {
+            curveRoadPointService.deleteCurveRoadPoint(
+              listenLayer.modifyPoint.linkedCurveRoadPointId
+            );
           }
         }
         this.history.save();
@@ -1089,11 +1290,23 @@ export default class Layer {
         break;
       case LayerEvents.MoveCurvePoint:
         needAutoRedraw = true;
-        if (listenLayer.modifyPoint && listenLayer.modifyPoint.linkedCurvePointId) {
-          let curvePoint1 = dataService.getCurvePoint(listenLayer.modifyPoint.linkedCurvePointId);
+        if (
+          listenLayer.modifyPoint &&
+          listenLayer.modifyPoint.linkedCurvePointId
+        ) {
+          let curvePoint1 = dataService.getCurvePoint(
+            listenLayer.modifyPoint.linkedCurvePointId
+          );
           let curvePoint2 = dataService.getCurvePoint(draggingItem.vectorId);
-          if (listenLayer.modifyPoint.linkedCurvePointId != draggingItem.vectorId && curvePoint1.getParent() == curvePoint2.getParent()) {
-            lineService.deleteCrossPointForCurveLine(listenLayer.modifyPoint.linkedCurvePointId, curvePoint1.getParent());
+          if (
+            listenLayer.modifyPoint.linkedCurvePointId !=
+              draggingItem.vectorId &&
+            curvePoint1.getParent() == curvePoint2.getParent()
+          ) {
+            lineService.deleteCrossPointForCurveLine(
+              listenLayer.modifyPoint.linkedCurvePointId,
+              curvePoint1.getParent()
+            );
           }
         }
         elementService.hideAll();
@@ -1138,7 +1351,9 @@ export default class Layer {
     const type = e.type;
     if (type == "DOMMouseScroll" || type == "mousewheel") {
       // 当在canvas用滚轮滚动时
-      const delta = e.wheelDelta ? (e.wheelDelta / 120) * 20 : (-(e.detail || 0) / 3) * 20;
+      const delta = e.wheelDelta
+        ? (e.wheelDelta / 120) * 20
+        : (-(e.detail || 0) / 3) * 20;
       const zoom = coordinate.zoom + delta;
       let X = e.offsetX || e.layerX;
       let Y = e.offsetY || e.layerY;
@@ -1242,7 +1457,10 @@ export default class Layer {
 
   stopAddVector() {
     let eventName = stateService.getEventName();
-    if (eventName != LayerEvents.AddingRoad && eventName != LayerEvents.AddingLine) {
+    if (
+      eventName != LayerEvents.AddingRoad &&
+      eventName != LayerEvents.AddingLine
+    ) {
       stateService.clearEventName();
     } else if (eventName == LayerEvents.AddingRoad) {
       stateService.setEventName(LayerEvents.AddRoad);
@@ -1380,23 +1598,57 @@ export default class Layer {
     let otherPoint1 = null;
     let otherPoint2 = null;
     if (listenLayer.modifyPoint && listenLayer.modifyPoint.linkedRoadPointIdX) {
-      otherPoint1 = dataService.getRoadPoint(listenLayer.modifyPoint.linkedRoadPointIdX);
-    } else if (listenLayer.modifyPoint && listenLayer.modifyPoint.linkedCurveRoadPointIdX) {
-      otherPoint1 = dataService.getCurveRoadPoint(listenLayer.modifyPoint.linkedCurvePointIdX);
-    } else if (listenLayer.modifyPoint && listenLayer.modifyPoint.linkedPointIdX) {
-      otherPoint1 = dataService.getPoint(listenLayer.modifyPoint.linkedPointIdX);
-    } else if (listenLayer.modifyPoint && listenLayer.modifyPoint.linkedCurvePointIdX) {
-      otherPoint1 = dataService.getCurvePoint(listenLayer.modifyPoint.linkedCurvePointIdX);
+      otherPoint1 = dataService.getRoadPoint(
+        listenLayer.modifyPoint.linkedRoadPointIdX
+      );
+    } else if (
+      listenLayer.modifyPoint &&
+      listenLayer.modifyPoint.linkedCurveRoadPointIdX
+    ) {
+      otherPoint1 = dataService.getCurveRoadPoint(
+        listenLayer.modifyPoint.linkedCurvePointIdX
+      );
+    } else if (
+      listenLayer.modifyPoint &&
+      listenLayer.modifyPoint.linkedPointIdX
+    ) {
+      otherPoint1 = dataService.getPoint(
+        listenLayer.modifyPoint.linkedPointIdX
+      );
+    } else if (
+      listenLayer.modifyPoint &&
+      listenLayer.modifyPoint.linkedCurvePointIdX
+    ) {
+      otherPoint1 = dataService.getCurvePoint(
+        listenLayer.modifyPoint.linkedCurvePointIdX
+      );
     }
 
     if (listenLayer.modifyPoint && listenLayer.modifyPoint.linkedRoadPointIdY) {
-      otherPoint2 = dataService.getRoadPoint(listenLayer.modifyPoint.linkedRoadPointIdY);
-    } else if (listenLayer.modifyPoint && listenLayer.modifyPoint.linkedCurvePointIdY) {
-      otherPoint2 = dataService.getCurveRoadPoint(listenLayer.modifyPoint.linkedCurvePointIdY);
-    } else if (listenLayer.modifyPoint && listenLayer.modifyPoint.linkedPointIdY) {
-      otherPoint2 = dataService.getPoint(listenLayer.modifyPoint.linkedPointIdY);
-    } else if (listenLayer.modifyPoint && listenLayer.modifyPoint.linkedCurvePointIdY) {
-      otherPoint2 = dataService.getCurvePoint(listenLayer.modifyPoint.linkedCurvePointIdY);
+      otherPoint2 = dataService.getRoadPoint(
+        listenLayer.modifyPoint.linkedRoadPointIdY
+      );
+    } else if (
+      listenLayer.modifyPoint &&
+      listenLayer.modifyPoint.linkedCurvePointIdY
+    ) {
+      otherPoint2 = dataService.getCurveRoadPoint(
+        listenLayer.modifyPoint.linkedCurvePointIdY
+      );
+    } else if (
+      listenLayer.modifyPoint &&
+      listenLayer.modifyPoint.linkedPointIdY
+    ) {
+      otherPoint2 = dataService.getPoint(
+        listenLayer.modifyPoint.linkedPointIdY
+      );
+    } else if (
+      listenLayer.modifyPoint &&
+      listenLayer.modifyPoint.linkedCurvePointIdY
+    ) {
+      otherPoint2 = dataService.getCurvePoint(
+        listenLayer.modifyPoint.linkedCurvePointIdY
+      );
     }
 
     let otherPoint = {};

+ 414 - 93
src/graphic/ListenLayer.js

@@ -15,6 +15,7 @@ import LayerEvents from "./enum/LayerEvents";
 import Style from "./CanvasStyle";
 import Settings from "./Settings";
 import { uiService } from "./Service/UIService";
+
 export default class ListenLayer {
   constructor(canvas, newsletter, graphicState) {
     this.modifyPoint = null;
@@ -39,31 +40,108 @@ export default class ListenLayer {
   }
    * @returns
    */
-  start(position, exceptVectorIds,vectorType) {
+  start(position, exceptVectorIds, vType) {
     let flag = false;
-    let selectInfo = {};
+    let selectInfo = {
+      textInfo: {},
+      magnifierInfo: {},
+      circleInfo: {},
+      curvePointInfo: {},
+      pointInfo: {},
+      curveLineInfo: {},
+      lineInfo: {},
+      svgInfo: {},
+      textInfo: {},
+      roadPointInfo: {},
+      curveRoadPointInfo: {},
+      curveRoadEdgeInfo: {},
+      roadEdgeInfo: {},
+      crossPointInfo: {},
+    };
+
     if (!exceptVectorIds) {
       exceptVectorIds = {};
     }
     this.clear();
-    selectInfo.curveRoadEdgeInfo = this.isSelectCurveRoad(position, exceptVectorIds.exceptCurveRoadId); //包括edge
-    selectInfo.roadEdgeInfo = this.isSelectRoad(position, exceptVectorIds.exceptRoadIds); //包括edge
-    selectInfo.curveRoadPointInfo = this.isSelectCurveRoadPoint(position, exceptVectorIds.exceptCurveRoadPointId);
-    selectInfo.roadPointInfo = this.isSelectRoadPoint(position, exceptVectorIds.exceptRoadPointId);
-    selectInfo.pointInfo = this.isSelectPoint(position, exceptVectorIds.exceptPointId, exceptVectorIds.exceptLineIds);
+    if (!vType || vType == VectorType.CurveRoad) {
+      selectInfo.curveRoadEdgeInfo = this.isSelectCurveRoad(
+        position,
+        exceptVectorIds.exceptCurveRoadId
+      ); //包括edge
+      selectInfo.curveRoadPointInfo = this.isSelectCurveRoadPoint(
+        position,
+        exceptVectorIds.exceptCurveRoadPointId
+      );
+    }
+
+    if (!vType || vType == VectorType.Road) {
+      selectInfo.roadEdgeInfo = this.isSelectRoad(
+        position,
+        exceptVectorIds.exceptRoadIds
+      ); //包括edge
+      selectInfo.roadPointInfo = this.isSelectRoadPoint(
+        position,
+        exceptVectorIds.exceptRoadPointId
+      );
+    }
+
+    if (!vType || vType == VectorType.Line) {
+      selectInfo.lineInfo = this.isSelectLine(
+        position,
+        exceptVectorIds.exceptLineIds
+      );
+      selectInfo.pointInfo = this.isSelectPoint(
+        position,
+        exceptVectorIds.exceptPointId,
+        exceptVectorIds.exceptLineIds
+      );
+    }
     // selectInfo.pointInfo = this.isSelectPoint(
     //   position,
     //   exceptVectorIds.exceptPointId
     // );
-    selectInfo.lineInfo = this.isSelectLine(position, exceptVectorIds.exceptLineIds);
-    selectInfo.curvePointInfo = this.isSelectCurvePoint(position, exceptVectorIds.exceptCurvePointId);
-    selectInfo.curveLineInfo = this.isSelectCurveLine(position, exceptVectorIds.exceptCurveLineId);
-    selectInfo.circleInfo = this.isSelectCircle(position, exceptVectorIds.exceptCircleId);
+
+    if (!vType || vType == VectorType.CurveLine) {
+      selectInfo.curvePointInfo = this.isSelectCurvePoint(
+        position,
+        exceptVectorIds.exceptCurvePointId
+      );
+      selectInfo.curveLineInfo = this.isSelectCurveLine(
+        position,
+        exceptVectorIds.exceptCurveLineId
+      );
+    }
+
+    //if (!vType || vType == VectorType.Circle) {
+    selectInfo.circleInfo = this.isSelectCircle(
+      position,
+      exceptVectorIds.exceptCircleId
+    );
+    //}
+
+    //if (!vType) {
     //交叉口拐弯处的控制点
-    selectInfo.crossPointInfo = this.isSelectCrossCrossPoint(position, exceptVectorIds.exceptCrossCrossPointId);
-    selectInfo.textInfo = this.isSelectText(position, exceptVectorIds.exceptTextId);
-    selectInfo.svgInfo = this.isSelectSVG(position, exceptVectorIds.exceptSVGId);
-    selectInfo.magnifierInfo = this.isSelectMagnifier(position, exceptVectorIds.exceptMagnifierId);
+    selectInfo.crossPointInfo = this.isSelectCrossCrossPoint(
+      position,
+      exceptVectorIds.exceptCrossCrossPointId
+    );
+    selectInfo.textInfo = this.isSelectText(
+      position,
+      exceptVectorIds.exceptTextId
+    );
+    selectInfo.magnifierInfo = this.isSelectMagnifier(
+      position,
+      exceptVectorIds.exceptMagnifierId
+    );
+    //
+
+    if (!vType || vType == VectorType.SVG) {
+      selectInfo.svgInfo = this.isSelectSVG(
+        position,
+        exceptVectorIds.exceptSVGId
+      );
+    }
+
     this.setModifyPoint(position, selectInfo);
     flag = this.updateSelectItem();
     return flag;
@@ -101,11 +179,19 @@ export default class ListenLayer {
           }
         }
       } else {
-        if ((Math.abs(position.x - curvePoint.x) * coordinate.zoom) / coordinate.defaultZoom < Constant.minAdsorbPix) {
+        if (
+          (Math.abs(position.x - curvePoint.x) * coordinate.zoom) /
+            coordinate.defaultZoom <
+          Constant.minAdsorbPix
+        ) {
           seqInfo.linkedCurvePointIdX = curvePointId;
           seqInfo.x = curvePoint.x;
         }
-        if ((Math.abs(position.y - curvePoint.y) * coordinate.zoom) / coordinate.defaultZoom < Constant.minAdsorbPix) {
+        if (
+          (Math.abs(position.y - curvePoint.y) * coordinate.zoom) /
+            coordinate.defaultZoom <
+          Constant.minAdsorbPix
+        ) {
           seqInfo.linkedPointIdY = curvePointId;
           seqInfo.y = curvePoint.y;
         }
@@ -114,7 +200,9 @@ export default class ListenLayer {
 
     if (curvePointInfo.curvePointId) {
       curvePointInfo.linkedCurvePointId = curvePointInfo.curvePointId;
-      const linkedCurvePoint = dataService.getCurvePoint(curvePointInfo.curvePointId);
+      const linkedCurvePoint = dataService.getCurvePoint(
+        curvePointInfo.curvePointId
+      );
       curvePointInfo.x = linkedCurvePoint.x;
       curvePointInfo.y = linkedCurvePoint.y;
     } else {
@@ -126,10 +214,16 @@ export default class ListenLayer {
         curvePointInfo.linkedCurvePointIdY = seqInfo.linkedCurvePointIdY;
         curvePointInfo.y = seqInfo.y;
       }
-      if (curvePointInfo.hasOwnProperty("y") && !curvePointInfo.hasOwnProperty("x")) {
+      if (
+        curvePointInfo.hasOwnProperty("y") &&
+        !curvePointInfo.hasOwnProperty("x")
+      ) {
         curvePointInfo.x = position.x;
       }
-      if (curvePointInfo.hasOwnProperty("x") && !curvePointInfo.hasOwnProperty("y")) {
+      if (
+        curvePointInfo.hasOwnProperty("x") &&
+        !curvePointInfo.hasOwnProperty("y")
+      ) {
         curvePointInfo.y = position.y;
       }
     }
@@ -144,12 +238,20 @@ export default class ListenLayer {
     };
     const curveLines = dataService.getCurveLines();
     for (const curveLineId in curveLines) {
-      if (exceptCurveLineIds && (exceptCurveLineIds.hasOwnProperty(curveLineId) || exceptCurveLineIds == curveLineId)) {
+      if (
+        exceptCurveLineIds &&
+        (exceptCurveLineIds.hasOwnProperty(curveLineId) ||
+          exceptCurveLineIds == curveLineId)
+      ) {
         continue;
       }
       const curveLine = dataService.getCurveLine(curveLineId);
 
-      let joinInfo = this.distanceForBezier(position, curveLine.curves, Constant.minAdsorbPix);
+      let joinInfo = this.distanceForBezier(
+        position,
+        curveLine.curves,
+        Constant.minAdsorbPix
+      );
       //选中了路
       if (joinInfo.distance < Constant.minAdsorbPix) {
         curveLineInfo = {
@@ -213,11 +315,19 @@ export default class ListenLayer {
           }
         }
       } else {
-        if ((Math.abs(position.x - point.x) * coordinate.zoom) / coordinate.defaultZoom < Constant.minAdsorbPix) {
+        if (
+          (Math.abs(position.x - point.x) * coordinate.zoom) /
+            coordinate.defaultZoom <
+          Constant.minAdsorbPix
+        ) {
           seqInfo.linkedPointIdX = pointId;
           seqInfo.x = point.x;
         }
-        if ((Math.abs(position.y - point.y) * coordinate.zoom) / coordinate.defaultZoom < Constant.minAdsorbPix) {
+        if (
+          (Math.abs(position.y - point.y) * coordinate.zoom) /
+            coordinate.defaultZoom <
+          Constant.minAdsorbPix
+        ) {
           seqInfo.linkedPointIdY = pointId;
           seqInfo.y = point.y;
         }
@@ -270,7 +380,8 @@ export default class ListenLayer {
         line.getCategory() == VectorCategory.Line.ExtendedPositionLine ||
         line.getCategory() == VectorCategory.Line.GuideLocationLine ||
         line.getCategory() == VectorCategory.Line.GuidePositionLine ||
-        (line.getCategory() == VectorCategory.Line.PositionLine && line.getLocationMode() != Constant.angleLocationMode)
+        (line.getCategory() == VectorCategory.Line.PositionLine &&
+          line.getLocationMode() != Constant.angleLocationMode)
       ) {
         continue;
       }
@@ -348,7 +459,12 @@ export default class ListenLayer {
       //     };
       //   }
       // }
-      const flag = mathUtil.isPointInElliptic(position, circle.center, circle.radiusX, circle.radiusY);
+      const flag = mathUtil.isPointInElliptic(
+        position,
+        circle.center,
+        circle.radiusX,
+        circle.radiusY
+      );
       if (flag) {
         circleInfo = {
           circleId: circleId,
@@ -395,10 +511,18 @@ export default class ListenLayer {
           }
         }
       } else {
-        if ((Math.abs(position.x - roadPoint.x) * coordinate.zoom) / coordinate.defaultZoom < Constant.minAdsorbPix) {
+        if (
+          (Math.abs(position.x - roadPoint.x) * coordinate.zoom) /
+            coordinate.defaultZoom <
+          Constant.minAdsorbPix
+        ) {
           seqInfo.linkedRoadPointIdX = roadPointId;
           seqInfo.x = roadPoint.x;
-        } else if ((Math.abs(position.y - roadPoint.y) * coordinate.zoom) / coordinate.defaultZoom < Constant.minAdsorbPix) {
+        } else if (
+          (Math.abs(position.y - roadPoint.y) * coordinate.zoom) /
+            coordinate.defaultZoom <
+          Constant.minAdsorbPix
+        ) {
           seqInfo.linkedRoadPointIdY = roadPointId;
           seqInfo.y = roadPoint.y;
         }
@@ -421,10 +545,16 @@ export default class ListenLayer {
         roadPointInfo.y = seqInfo.y;
       }
 
-      if (roadPointInfo.hasOwnProperty("y") && !roadPointInfo.hasOwnProperty("x")) {
+      if (
+        roadPointInfo.hasOwnProperty("y") &&
+        !roadPointInfo.hasOwnProperty("x")
+      ) {
         roadPointInfo.x = position.x;
       }
-      if (roadPointInfo.hasOwnProperty("x") && !roadPointInfo.hasOwnProperty("y")) {
+      if (
+        roadPointInfo.hasOwnProperty("x") &&
+        !roadPointInfo.hasOwnProperty("y")
+      ) {
         roadPointInfo.y = position.y;
       }
     }
@@ -464,10 +594,18 @@ export default class ListenLayer {
           }
         }
       } else {
-        if ((Math.abs(position.x - curveRoadPoint.x) * coordinate.zoom) / coordinate.defaultZoom < Constant.minAdsorbPix) {
+        if (
+          (Math.abs(position.x - curveRoadPoint.x) * coordinate.zoom) /
+            coordinate.defaultZoom <
+          Constant.minAdsorbPix
+        ) {
           seqInfo.linkedCurveRoadPointIdX = curveRoadPointId;
           seqInfo.x = curveRoadPoint.x;
-        } else if ((Math.abs(position.y - curveRoadPoint.y) * coordinate.zoom) / coordinate.defaultZoom < Constant.minAdsorbPix) {
+        } else if (
+          (Math.abs(position.y - curveRoadPoint.y) * coordinate.zoom) /
+            coordinate.defaultZoom <
+          Constant.minAdsorbPix
+        ) {
           seqInfo.linkedCurveRoadPointIdY = curveRoadPointId;
           seqInfo.y = curveRoadPoint.y;
         }
@@ -475,22 +613,33 @@ export default class ListenLayer {
     }
 
     if (curveRoadPointInfo.curveRoadPointId) {
-      curveRoadPointInfo.linkedCurveRoadPointId = curveRoadPointInfo.curveRoadPointId;
-      const linkedCurvePoint = dataService.getCurveRoadPoint(curveRoadPointInfo.curveRoadPointId);
+      curveRoadPointInfo.linkedCurveRoadPointId =
+        curveRoadPointInfo.curveRoadPointId;
+      const linkedCurvePoint = dataService.getCurveRoadPoint(
+        curveRoadPointInfo.curveRoadPointId
+      );
       curveRoadPointInfo.x = linkedCurvePoint.x;
       curveRoadPointInfo.y = linkedCurvePoint.y;
     } else {
       if (seqInfo.hasOwnProperty("linkedCurveRoadPointIdX")) {
-        curveRoadPointInfo.linkedCurveRoadPointIdX = seqInfo.linkedCurveRoadPointIdX;
+        curveRoadPointInfo.linkedCurveRoadPointIdX =
+          seqInfo.linkedCurveRoadPointIdX;
         curveRoadPointInfo.x = seqInfo.x;
       } else if (seqInfo.hasOwnProperty("linkedCurveRoadPointIdY")) {
-        curveRoadPointInfo.linkedCurveRoadPointIdY = seqInfo.linkedCurveRoadPointIdY;
+        curveRoadPointInfo.linkedCurveRoadPointIdY =
+          seqInfo.linkedCurveRoadPointIdY;
         curveRoadPointInfo.y = seqInfo.y;
       }
-      if (curveRoadPointInfo.hasOwnProperty("y") && !curveRoadPointInfo.hasOwnProperty("x")) {
+      if (
+        curveRoadPointInfo.hasOwnProperty("y") &&
+        !curveRoadPointInfo.hasOwnProperty("x")
+      ) {
         curveRoadPointInfo.x = position.x;
       }
-      if (curveRoadPointInfo.hasOwnProperty("x") && !curveRoadPointInfo.hasOwnProperty("y")) {
+      if (
+        curveRoadPointInfo.hasOwnProperty("x") &&
+        !curveRoadPointInfo.hasOwnProperty("y")
+      ) {
         curveRoadPointInfo.y = position.y;
       }
     }
@@ -527,13 +676,25 @@ export default class ListenLayer {
       let rightLine = mathUtil.createLine1(rightEdge.start, rightEdge.end);
       let rightJoin = mathUtil.getJoinLinePoint(position, rightLine);
 
-      let leftSideLine = leftEdge.roadSide ? mathUtil.createLine1(leftEdge.roadSide.start, leftEdge.roadSide.end) : null;
-      let leftSideJoin = leftSideLine ? mathUtil.getJoinLinePoint(position, leftSideLine) : null;
+      let leftSideLine = leftEdge.roadSide
+        ? mathUtil.createLine1(leftEdge.roadSide.start, leftEdge.roadSide.end)
+        : null;
+      let leftSideJoin = leftSideLine
+        ? mathUtil.getJoinLinePoint(position, leftSideLine)
+        : null;
 
-      let rightSideLine = rightEdge.roadSide ? mathUtil.createLine1(rightEdge.roadSide.start, rightEdge.roadSide.end) : null;
-      let rightSideJoin = rightSideLine ? mathUtil.getJoinLinePoint(position, rightSideLine) : null;
+      let rightSideLine = rightEdge.roadSide
+        ? mathUtil.createLine1(rightEdge.roadSide.start, rightEdge.roadSide.end)
+        : null;
+      let rightSideJoin = rightSideLine
+        ? mathUtil.getJoinLinePoint(position, rightSideLine)
+        : null;
       let distance = this.getDistance(position, join);
-      if (mathUtil.isContainForSegment(join, startPoint, endPoint) && (mathUtil.isContainForSegment(position, join, leftJoin) || mathUtil.isContainForSegment(position, join, rightJoin))) {
+      if (
+        mathUtil.isContainForSegment(join, startPoint, endPoint) &&
+        (mathUtil.isContainForSegment(position, join, leftJoin) ||
+          mathUtil.isContainForSegment(position, join, rightJoin))
+      ) {
         if (!roadInfo.roadId || distance < roadInfo.distance) {
           roadInfo = {
             roadId: roadId,
@@ -565,8 +726,11 @@ export default class ListenLayer {
 
       distance = this.getDistance(position, leftJoin);
       if (
-        (mathUtil.isContainForSegment(leftJoin, leftEdge.start, leftEdge.end) && distance < Constant.minAdsorbPix / 2) ||
-        (mathUtil.isContainForSegment(join, startPoint, endPoint) && leftSideJoin && mathUtil.isContainForSegment(position, leftSideJoin, leftJoin))
+        (mathUtil.isContainForSegment(leftJoin, leftEdge.start, leftEdge.end) &&
+          distance < Constant.minAdsorbPix / 2) ||
+        (mathUtil.isContainForSegment(join, startPoint, endPoint) &&
+          leftSideJoin &&
+          mathUtil.isContainForSegment(position, leftSideJoin, leftJoin))
       ) {
         if (!edgeInfo.edgeId || distance < edgeInfo.distance) {
           edgeInfo = {
@@ -581,8 +745,15 @@ export default class ListenLayer {
       distance = this.getDistance(position, rightJoin);
 
       if (
-        (mathUtil.isContainForSegment(rightJoin, rightEdge.start, rightEdge.end) && distance < Constant.minAdsorbPix / 2) ||
-        (mathUtil.isContainForSegment(join, startPoint, endPoint) && rightSideJoin && mathUtil.isContainForSegment(position, rightSideJoin, rightJoin))
+        (mathUtil.isContainForSegment(
+          rightJoin,
+          rightEdge.start,
+          rightEdge.end
+        ) &&
+          distance < Constant.minAdsorbPix / 2) ||
+        (mathUtil.isContainForSegment(join, startPoint, endPoint) &&
+          rightSideJoin &&
+          mathUtil.isContainForSegment(position, rightSideJoin, rightJoin))
       ) {
         if (!edgeInfo.edgeId || distance < edgeInfo.distance) {
           edgeInfo = {
@@ -595,10 +766,16 @@ export default class ListenLayer {
       }
     }
 
-    if (roadInfo.roadId && (!edgeInfo.edgeId || roadInfo.distance < edgeInfo.distance)) {
+    if (
+      roadInfo.roadId &&
+      (!edgeInfo.edgeId || roadInfo.distance < edgeInfo.distance)
+    ) {
       const linkedRoad = dataService.getRoad(roadInfo.roadId);
       const linkedRoadLine = roadService.getMidLine(linkedRoad);
-      const linkedPosition = mathUtil.getJoinLinePoint(position, linkedRoadLine);
+      const linkedPosition = mathUtil.getJoinLinePoint(
+        position,
+        linkedRoadLine
+      );
 
       roadInfo.x = linkedPosition.x;
       roadInfo.y = linkedPosition.y;
@@ -662,14 +839,33 @@ export default class ListenLayer {
       console.log("isSelectCurveRoad:" + JSON.stringify(joinInfo));
       //检查edge
       const leftCurveEdge = dataService.getCurveRoadEdge(curveRoad.leftEdgeId);
-      const leftJoinInfo = this.distanceForBezier(position, leftCurveEdge.curves, Constant.minAdsorbPix);
+      const leftJoinInfo = this.distanceForBezier(
+        position,
+        leftCurveEdge.curves,
+        Constant.minAdsorbPix
+      );
 
-      const rightCurveEdge = dataService.getCurveRoadEdge(curveRoad.rightEdgeId);
-      const rightJoinInfo = this.distanceForBezier(position, rightCurveEdge.curves, Constant.minAdsorbPix);
+      const rightCurveEdge = dataService.getCurveRoadEdge(
+        curveRoad.rightEdgeId
+      );
+      const rightJoinInfo = this.distanceForBezier(
+        position,
+        rightCurveEdge.curves,
+        Constant.minAdsorbPix
+      );
 
-      let line1 = mathUtil.createLine1(joinInfo.position, leftJoinInfo.position);
+      let line1 = mathUtil.createLine1(
+        joinInfo.position,
+        leftJoinInfo.position
+      );
       let position1 = mathUtil.getJoinLinePoint(position, line1);
-      if (mathUtil.isContainForSegment(position1, joinInfo.position, leftJoinInfo.position)) {
+      if (
+        mathUtil.isContainForSegment(
+          position1,
+          joinInfo.position,
+          leftJoinInfo.position
+        )
+      ) {
         if (joinInfo.distance < curveRoad.leftWidth) {
           curveRoadInfo = {
             curveRoadId: curveRoadId,
@@ -681,10 +877,19 @@ export default class ListenLayer {
         }
         curveRoadInfo.dir = "left";
       } else {
-        let line2 = mathUtil.createLine1(joinInfo.position, rightJoinInfo.position);
+        let line2 = mathUtil.createLine1(
+          joinInfo.position,
+          rightJoinInfo.position
+        );
 
         let position2 = mathUtil.getJoinLinePoint(position, line2);
-        if (mathUtil.isContainForSegment(position2, joinInfo.position, rightJoinInfo.position)) {
+        if (
+          mathUtil.isContainForSegment(
+            position2,
+            joinInfo.position,
+            rightJoinInfo.position
+          )
+        ) {
           if (joinInfo.distance < curveRoad.rightWidth) {
             curveRoadInfo = {
               curveRoadId: curveRoadId,
@@ -699,7 +904,10 @@ export default class ListenLayer {
       }
 
       if (leftJoinInfo.distance < Constant.minAdsorbPix) {
-        const index = mathUtil.getCurvesIndexForCurvesPoints(leftJoinInfo.position, curveRoad.points);
+        const index = mathUtil.getCurvesIndexForCurvesPoints(
+          leftJoinInfo.position,
+          curveRoad.points
+        );
         curveEdgeInfo = {
           curveEdgeId: curveRoad.leftEdgeId,
           type: VectorType.CurveRoadEdge,
@@ -709,7 +917,10 @@ export default class ListenLayer {
           y: leftJoinInfo.position.y,
         };
       } else if (rightJoinInfo.distance < Constant.minAdsorbPix) {
-        const index = mathUtil.getCurvesIndexForCurvesPoints(rightJoinInfo.position, curveRoad.points);
+        const index = mathUtil.getCurvesIndexForCurvesPoints(
+          rightJoinInfo.position,
+          curveRoad.points
+        );
         curveEdgeInfo = {
           curveEdgeId: curveRoad.rightEdgeId,
           type: VectorType.CurveRoadEdge,
@@ -720,7 +931,11 @@ export default class ListenLayer {
         };
       }
     }
-    if (curveRoadInfo.curveRoadId && (!curveEdgeInfo.curveEdgeId || curveRoadInfo.distance < curveEdgeInfo.distance)) {
+    if (
+      curveRoadInfo.curveRoadId &&
+      (!curveEdgeInfo.curveEdgeId ||
+        curveRoadInfo.distance < curveEdgeInfo.distance)
+    ) {
       // console.log("选中的CurveRoad:" + curveRoadInfo.curveRoadId);
       return curveRoadInfo;
     } else if (curveEdgeInfo.curveEdgeId) {
@@ -930,7 +1145,10 @@ export default class ListenLayer {
       this.modifyPoint.index = info.circleInfo.index;
       this.modifyPoint.x = info.circleInfo.x;
       this.modifyPoint.y = info.circleInfo.y;
-    } else if (info && (info.pointInfo.pointId || info.curvePointInfo.curvePointId)) {
+    } else if (
+      info &&
+      (info.pointInfo.pointId || info.curvePointInfo.curvePointId)
+    ) {
       this.modifyPoint = {};
       if (info.pointInfo.pointId && info.curvePointInfo.curvePointId) {
         if (info.pointInfo.distance < info.curvePointInfo.distance) {
@@ -938,7 +1156,8 @@ export default class ListenLayer {
           this.modifyPoint.x = info.pointInfo.x;
           this.modifyPoint.y = info.pointInfo.y;
         } else {
-          this.modifyPoint.linkedCurvePointId = info.curvePointInfo.curvePointId;
+          this.modifyPoint.linkedCurvePointId =
+            info.curvePointInfo.curvePointId;
           this.modifyPoint.x = info.curvePointInfo.x;
           this.modifyPoint.y = info.curvePointInfo.y;
         }
@@ -951,7 +1170,10 @@ export default class ListenLayer {
         this.modifyPoint.x = info.curvePointInfo.x;
         this.modifyPoint.y = info.curvePointInfo.y;
       }
-    } else if (info && (info.lineInfo.lineId || info.curveLineInfo.curveLineId)) {
+    } else if (
+      info &&
+      (info.lineInfo.lineId || info.curveLineInfo.curveLineId)
+    ) {
       this.modifyPoint = {};
       if (info.lineInfo.lineId && info.curveLineInfo.curveLineId) {
         if (info.lineInfo.distance < info.curveLineInfo.distance) {
@@ -978,14 +1200,22 @@ export default class ListenLayer {
       this.modifyPoint.index = info.svgInfo.index;
       this.modifyPoint.x = info.svgInfo.x;
       this.modifyPoint.y = info.svgInfo.y;
-    } else if (info && (info.roadPointInfo.roadPointId || info.curveRoadPointInfo.curveRoadPointId)) {
-      if (info.roadPointInfo.roadPointId && info.curveRoadPointInfo.curveRoadPointId) {
+    } else if (
+      info &&
+      (info.roadPointInfo.roadPointId ||
+        info.curveRoadPointInfo.curveRoadPointId)
+    ) {
+      if (
+        info.roadPointInfo.roadPointId &&
+        info.curveRoadPointInfo.curveRoadPointId
+      ) {
         if (info.roadPointInfo.distance < info.curveRoadPointInfo.distance) {
           this.modifyPoint.linkedRoadPointId = info.roadPointInfo.roadPointId;
           this.modifyPoint.x = info.roadPointInfo.x;
           this.modifyPoint.y = info.roadPointInfo.y;
         } else {
-          this.modifyPoint.linkedCurveRoadPointId = info.curveRoadPointInfo.curveRoadPointId;
+          this.modifyPoint.linkedCurveRoadPointId =
+            info.curveRoadPointInfo.curveRoadPointId;
           this.modifyPoint.x = info.curveRoadPointInfo.x;
           this.modifyPoint.y = info.curveRoadPointInfo.y;
         }
@@ -994,11 +1224,15 @@ export default class ListenLayer {
         this.modifyPoint.x = info.roadPointInfo.x;
         this.modifyPoint.y = info.roadPointInfo.y;
       } else if (info.curveRoadPointInfo.curveRoadPointId) {
-        this.modifyPoint.linkedCurveRoadPointId = info.curveRoadPointInfo.curveRoadPointId;
+        this.modifyPoint.linkedCurveRoadPointId =
+          info.curveRoadPointInfo.curveRoadPointId;
         this.modifyPoint.x = info.curveRoadPointInfo.x;
         this.modifyPoint.y = info.curveRoadPointInfo.y;
       }
-    } else if (info && (info.roadEdgeInfo.roadId || info.curveRoadEdgeInfo.curveRoadId)) {
+    } else if (
+      info &&
+      (info.roadEdgeInfo.roadId || info.curveRoadEdgeInfo.curveRoadId)
+    ) {
       this.modifyPoint = {};
       if (info.roadEdgeInfo.roadId && info.curveRoadEdgeInfo.curveRoadId) {
         if (roadEdgeInfo.distance < info.curveRoadEdgeInfo.distance) {
@@ -1023,7 +1257,10 @@ export default class ListenLayer {
         this.modifyPoint.y = info.curveRoadEdgeInfo.y;
         this.modifyPoint.dir = info.curveRoadEdgeInfo.dir;
       }
-    } else if (info && (info.roadEdgeInfo.edgeId || info.curveRoadEdgeInfo.curveEdgeId)) {
+    } else if (
+      info &&
+      (info.roadEdgeInfo.edgeId || info.curveRoadEdgeInfo.curveEdgeId)
+    ) {
       this.modifyPoint = {};
       if (info.roadEdgeInfo.edgeId && info.curveRoadEdgeInfo.curveEdgeId) {
         if (info.roadEdgeInfo.distance < info.curveRoadEdgeInfo.distance) {
@@ -1031,7 +1268,8 @@ export default class ListenLayer {
           this.modifyPoint.x = info.roadEdgeInfo.x;
           this.modifyPoint.y = info.roadEdgeInfo.y;
         } else {
-          this.modifyPoint.linkedCurveEdgeId = info.curveRoadEdgeInfo.curveEdgeId;
+          this.modifyPoint.linkedCurveEdgeId =
+            info.curveRoadEdgeInfo.curveEdgeId;
           this.modifyPoint.selectIndex = info.curveRoadEdgeInfo.selectIndex;
           this.modifyPoint.x = info.curveRoadEdgeInfo.x;
           this.modifyPoint.y = info.curveRoadEdgeInfo.y;
@@ -1048,40 +1286,57 @@ export default class ListenLayer {
       }
     } else if (info && info.crossPointInfo.crossCrossPointId) {
       this.modifyPoint = {};
-      this.modifyPoint.linkedCrossCrossPointId = info.crossPointInfo.crossCrossPointId;
+      this.modifyPoint.linkedCrossCrossPointId =
+        info.crossPointInfo.crossCrossPointId;
       this.modifyPoint.x = info.crossPointInfo.x;
       this.modifyPoint.y = info.crossPointInfo.y;
     } else if (info && info.roadPointInfo.linkedRoadPointIdX) {
       this.modifyPoint = {};
-      this.modifyPoint.linkedRoadPointIdX = info.roadPointInfo.linkedRoadPointIdX;
+      this.modifyPoint.linkedRoadPointIdX =
+        info.roadPointInfo.linkedRoadPointIdX;
       this.modifyPoint.x = info.roadPointInfo.x;
       this.modifyPoint.y = info.roadPointInfo.y;
     } else if (info && info.roadPointInfo.linkedRoadPointIdY) {
       this.modifyPoint = {};
-      this.modifyPoint.linkedRoadPointIdY = info.roadPointInfo.linkedRoadPointIdY;
+      this.modifyPoint.linkedRoadPointIdY =
+        info.roadPointInfo.linkedRoadPointIdY;
       this.modifyPoint.y = info.roadPointInfo.y;
       this.modifyPoint.x = info.roadPointInfo.x;
     } else if (info && info.curvePointInfo.linkedRoadPointIdX) {
       this.modifyPoint = {};
-      this.modifyPoint.linkedRoadPointIdX = info.curvePointInfo.linkedRoadPointIdX;
+      this.modifyPoint.linkedRoadPointIdX =
+        info.curvePointInfo.linkedRoadPointIdX;
       this.modifyPoint.x = info.curvePointInfo.x;
       this.modifyPoint.y = position.y;
     } else if (info && info.curvePointInfo.linkedRoadPointIdY) {
       this.modifyPoint = {};
-      this.modifyPoint.linkedRoadPointIdY = info.curvePointInfo.linkedRoadPointIdY;
+      this.modifyPoint.linkedRoadPointIdY =
+        info.curvePointInfo.linkedRoadPointIdY;
       this.modifyPoint.y = info.curvePointInfo.y;
       this.modifyPoint.x = position.x;
-    } else if (info && info.pointInfo.linkedPointIdX && !info.pointInfo.linkedPointIdY) {
+    } else if (
+      info &&
+      info.pointInfo.linkedPointIdX &&
+      !info.pointInfo.linkedPointIdY
+    ) {
       this.modifyPoint = {};
       this.modifyPoint.linkedPointIdX = info.pointInfo.linkedPointIdX;
       this.modifyPoint.x = info.pointInfo.x;
       this.modifyPoint.y = info.pointInfo.y;
-    } else if (info && info.pointInfo.linkedPointIdY && !info.pointInfo.linkedPointIdX) {
+    } else if (
+      info &&
+      info.pointInfo.linkedPointIdY &&
+      !info.pointInfo.linkedPointIdX
+    ) {
       this.modifyPoint = {};
       this.modifyPoint.linkedPointIdY = info.pointInfo.linkedPointIdY;
       this.modifyPoint.y = info.pointInfo.y;
       this.modifyPoint.x = info.pointInfo.x;
-    } else if (info && info.pointInfo.linkedPointIdY && info.pointInfo.linkedPointIdX) {
+    } else if (
+      info &&
+      info.pointInfo.linkedPointIdY &&
+      info.pointInfo.linkedPointIdX
+    ) {
       this.modifyPoint = {};
       this.modifyPoint.linkedPointIdX = info.pointInfo.linkedPointIdX;
       this.modifyPoint.linkedPointIdY = info.pointInfo.linkedPointIdY;
@@ -1102,40 +1357,103 @@ export default class ListenLayer {
         return false;
       }
     } else if (this.modifyPoint.linkedRoadPointId) {
-      stateService.setSelectItem(this.modifyPoint.linkedRoadPointId, VectorType.RoadPoint, SelectState.Select);
+      stateService.setSelectItem(
+        this.modifyPoint.linkedRoadPointId,
+        VectorType.RoadPoint,
+        SelectState.Select
+      );
     } else if (this.modifyPoint.linkedCurveRoadPointId) {
-      stateService.setSelectItem(this.modifyPoint.linkedCurveRoadPointId, VectorType.CurveRoadPoint, SelectState.Select, this.modifyPoint.dir);
+      stateService.setSelectItem(
+        this.modifyPoint.linkedCurveRoadPointId,
+        VectorType.CurveRoadPoint,
+        SelectState.Select,
+        this.modifyPoint.dir
+      );
     } else if (this.modifyPoint.linkedRoadId) {
-      stateService.setSelectItem(this.modifyPoint.linkedRoadId, VectorType.Road, SelectState.Select, this.modifyPoint.dir);
+      stateService.setSelectItem(
+        this.modifyPoint.linkedRoadId,
+        VectorType.Road,
+        SelectState.Select,
+        this.modifyPoint.dir
+      );
     } else if (this.modifyPoint.linkedCurveRoadId) {
-      stateService.setSelectItem(this.modifyPoint.linkedCurveRoadId, VectorType.CurveRoad, SelectState.Select, this.modifyPoint.dir);
+      stateService.setSelectItem(
+        this.modifyPoint.linkedCurveRoadId,
+        VectorType.CurveRoad,
+        SelectState.Select,
+        this.modifyPoint.dir
+      );
     } else if (this.modifyPoint.linkedCrossCrossPointId) {
-      stateService.setSelectItem(this.modifyPoint.linkedCrossCrossPointId, VectorType.CrossPoint, SelectState.Select);
+      stateService.setSelectItem(
+        this.modifyPoint.linkedCrossCrossPointId,
+        VectorType.CrossPoint,
+        SelectState.Select
+      );
     } else if (this.modifyPoint.textId) {
-      stateService.setSelectItem(this.modifyPoint.textId, VectorType.Text, SelectState.Select);
+      stateService.setSelectItem(
+        this.modifyPoint.textId,
+        VectorType.Text,
+        SelectState.Select
+      );
     } else if (this.modifyPoint.magnifierId) {
       // if (this.modifyPoint.index == 0) {
       //点击隐藏的放大镜不显示
-      stateService.setSelectItem(this.modifyPoint.magnifierId, VectorType.Magnifier, this.modifyPoint.index);
+      stateService.setSelectItem(
+        this.modifyPoint.magnifierId,
+        VectorType.Magnifier,
+        this.modifyPoint.index
+      );
       // } else {
       stateService.setSelectState(this.modifyPoint.index);
       // }
     } else if (this.modifyPoint.svgId) {
-      stateService.setSelectItem(this.modifyPoint.svgId, VectorType.SVG, this.modifyPoint.index);
+      stateService.setSelectItem(
+        this.modifyPoint.svgId,
+        VectorType.SVG,
+        this.modifyPoint.index
+      );
     } else if (this.modifyPoint.linkedEdgeId) {
-      stateService.setSelectItem(this.modifyPoint.linkedEdgeId, VectorType.RoadEdge, SelectState.Select);
+      stateService.setSelectItem(
+        this.modifyPoint.linkedEdgeId,
+        VectorType.RoadEdge,
+        SelectState.Select
+      );
     } else if (this.modifyPoint.linkedCurveEdgeId) {
-      stateService.setSelectItem(this.modifyPoint.linkedCurveEdgeId, VectorType.CurveRoadEdge, SelectState.Select);
+      stateService.setSelectItem(
+        this.modifyPoint.linkedCurveEdgeId,
+        VectorType.CurveRoadEdge,
+        SelectState.Select
+      );
     } else if (this.modifyPoint.linkedPointId) {
-      stateService.setSelectItem(this.modifyPoint.linkedPointId, VectorType.Point, SelectState.Select);
+      stateService.setSelectItem(
+        this.modifyPoint.linkedPointId,
+        VectorType.Point,
+        SelectState.Select
+      );
     } else if (this.modifyPoint.linkedCurvePointId) {
-      stateService.setSelectItem(this.modifyPoint.linkedCurvePointId, VectorType.CurvePoint, SelectState.Select);
+      stateService.setSelectItem(
+        this.modifyPoint.linkedCurvePointId,
+        VectorType.CurvePoint,
+        SelectState.Select
+      );
     } else if (this.modifyPoint.linkedLineId) {
-      stateService.setSelectItem(this.modifyPoint.linkedLineId, VectorType.Line, SelectState.Select);
+      stateService.setSelectItem(
+        this.modifyPoint.linkedLineId,
+        VectorType.Line,
+        SelectState.Select
+      );
     } else if (this.modifyPoint.linkedCurveLineId) {
-      stateService.setSelectItem(this.modifyPoint.linkedCurveLineId, VectorType.CurveLine, SelectState.Select);
+      stateService.setSelectItem(
+        this.modifyPoint.linkedCurveLineId,
+        VectorType.CurveLine,
+        SelectState.Select
+      );
     } else if (this.modifyPoint.linkedCircleId) {
-      stateService.setSelectItem(this.modifyPoint.linkedCircleId, VectorType.Circle, this.modifyPoint.index);
+      stateService.setSelectItem(
+        this.modifyPoint.linkedCircleId,
+        VectorType.Circle,
+        this.modifyPoint.index
+      );
     } else {
       stateService.clearSelectItem();
     }
@@ -1173,7 +1491,10 @@ export default class ListenLayer {
 
   //调整到与像素的长度一致
   getDistance(start, end) {
-    return (mathUtil.getDistance(start, end) * coordinate.zoom) / coordinate.defaultZoom;
+    return (
+      (mathUtil.getDistance(start, end) * coordinate.zoom) /
+      coordinate.defaultZoom
+    );
   }
 
   clear() {