|
@@ -190,33 +190,23 @@ export default class ListenLayer {
|
|
|
continue;
|
|
|
}
|
|
|
const curveLine = dataService.getCurveLine(curveLineId);
|
|
|
- let startPoint = dataService.getCurvePoint(curveLine.startId);
|
|
|
- let endPoint = dataService.getCurvePoint(curveLine.endId);
|
|
|
- const comLine = mathUtil.createLine1(startPoint, endPoint);
|
|
|
- const join = mathUtil.getJoinLinePoint(position, comLine);
|
|
|
- const distance = this.getDistance(position, join);
|
|
|
- if (!mathUtil.isContainForSegment(join, startPoint, endPoint)) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- if (distance < Constant.minAdsorbPix / 2) {
|
|
|
+
|
|
|
+ let joinInfo = this.distanceForBezier(
|
|
|
+ position,
|
|
|
+ curveLine.curves,
|
|
|
+ Constant.minAdsorbPix
|
|
|
+ );
|
|
|
+ //选中了路
|
|
|
+ if (joinInfo.distance < Constant.minAdsorbPix) {
|
|
|
curveLineInfo = {
|
|
|
curveLineId: curveLineId,
|
|
|
type: VectorType.CurveLine,
|
|
|
- distance: distance,
|
|
|
+ distance: joinInfo.distance,
|
|
|
+ x: joinInfo.position.x,
|
|
|
+ y: joinInfo.position.y,
|
|
|
};
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- if (curveLineInfo.curveLineId) {
|
|
|
- const linkedLine = dataService.getLine(lineInfo.curveLineId);
|
|
|
- let startPoint = dataService.getCurvePoint(linkedLine.startId);
|
|
|
- let endPoint = dataService.getCurvePoint(linkedLine.endId);
|
|
|
- const linkedComLine = mathUtil.createLine1(startPoint, endPoint);
|
|
|
- const linkedPosition = mathUtil.getJoinLinePoint(position, linkedComLine);
|
|
|
- curveLineInfo.x = linkedPosition.x;
|
|
|
- curveLineInfo.y = linkedPosition.y;
|
|
|
- return curveLineInfo;
|
|
|
- }
|
|
|
return curveLineInfo;
|
|
|
}
|
|
|
|