Browse Source

修复bug

xushiting 2 years ago
parent
commit
1606e1180f
2 changed files with 8 additions and 2 deletions
  1. 6 0
      src/graphic/ListenLayer.js
  2. 2 2
      src/graphic/Util/MathUtil.js

+ 6 - 0
src/graphic/ListenLayer.js

@@ -760,6 +760,12 @@ export default class ListenLayer {
         //Constant.minAdsorbPix
         Math.max(curveRoad.leftWidth, curveRoad.rightWidth)
       );
+
+      let index = mathUtil.getIndexForCurvesPoints(position, curveRoad.points);
+      if (index == 0 || index == curveRoad.points.length) {
+        continue;
+      }
+
       console.log("isSelectCurveRoad:" + JSON.stringify(joinInfo));
       //检查edge
       const leftCurveEdge = dataService.getCurveRoadEdge(curveRoad.leftEdgeId);

+ 2 - 2
src/graphic/Util/MathUtil.js

@@ -1623,7 +1623,7 @@ export default class MathUtil {
       if (this.isContainForSegment(join, points[i], points[i + 1])) {
         if (minDis == null || minDis > dis) {
           minDis = dis;
-          index = i;
+          index = i + 1;
         }
       }
       if (minDisToPoint == null) {
@@ -1634,7 +1634,7 @@ export default class MathUtil {
         minPointIndex = i;
       }
     }
-    if ((index = -1)) {
+    if (index == -1) {
       if (
         minDisToPoint >
         mathUtil.getDistance(position, points[points.length - 1])