xushiting vor 2 Jahren
Ursprung
Commit
0a7d371f98
2 geänderte Dateien mit 39 neuen und 20 gelöschten Zeilen
  1. 4 1
      src/graphic/Controls/MoveCircle.js
  2. 35 19
      src/graphic/ListenLayer.js

+ 4 - 1
src/graphic/Controls/MoveCircle.js

@@ -12,7 +12,10 @@ export default class MoveCircle {
     let circle = dataService.getCircle(circleId);
     circle.center.x += dx;
     circle.center.y += dy;
-    circle.createPoints();
+    for (let i = 0; i < circle.points.length; ++i) {
+      circle.points[i].x += dx;
+      circle.points[i].y += dy;
+    }
   }
 
   movePoint(position, circleId, pointIndex) {

+ 35 - 19
src/graphic/ListenLayer.js

@@ -361,18 +361,34 @@ export default class ListenLayer {
           return circleInfo;
         }
       }
-      distance = this.getDistance(position, circle.center);
-      if (distance < circle.radius) {
-        if (circleInfo.circleId == null || distance < circleInfo.distance) {
-          circleInfo = {
-            circleId: circleId,
-            type: VectorType.Circle,
-            distance: distance,
-            x: circle.center.x,
-            y: circle.center.y,
-            index: -1,
-          };
-        }
+
+      // distance = this.getDistance(position, circle.center);
+      // if (distance < circle.radius) {
+      //   if (circleInfo.circleId == null || distance < circleInfo.distance) {
+      //     circleInfo = {
+      //       circleId: circleId,
+      //       type: VectorType.Circle,
+      //       distance: distance,
+      //       x: circle.center.x,
+      //       y: circle.center.y,
+      //       index: -1,
+      //     };
+      //   }
+      // }
+      const flag = mathUtil.isPointInElliptic(
+        position,
+        circle.center,
+        circle.radiusX,
+        circle.radiusY
+      );
+      if (flag) {
+        circleInfo = {
+          circleId: circleId,
+          type: VectorType.Circle,
+          x: circle.center.x,
+          y: circle.center.y,
+          index: -1,
+        };
       }
     }
 
@@ -1215,14 +1231,14 @@ export default class ListenLayer {
       );
     } 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);
+      stateService.setSelectState(this.modifyPoint.index);
       // }
     } else if (this.modifyPoint.linkedEdgeId) {
       stateService.setSelectItem(