xushiting 2 anni fa
parent
commit
924d3a7ea4
2 ha cambiato i file con 26 aggiunte e 21 eliminazioni
  1. 1 0
      src/graphic/Controls/MoveLine.js
  2. 25 21
      src/graphic/Controls/MovePoint.js

+ 1 - 0
src/graphic/Controls/MoveLine.js

@@ -172,6 +172,7 @@ export default class MoveLine {
           let msg = locationModeControl.beforeSetLocation();
           if (msg != Msg.OK) {
             uiService.prompt({ msg: msg, time: 1000 });
+            uiService.setSelectLocationMode(null);
           } else {
             startPoint.x += dx;
             startPoint.y += dy;

+ 25 - 21
src/graphic/Controls/MovePoint.js

@@ -27,6 +27,7 @@ export default class MovePoint {
             let msg = locationModeControl.beforeSetLocation();
             if (msg != Msg.OK) {
               uiService.prompt({ msg: msg, time: 1000 });
+              uiService.setSelectLocationMode(null);
               return false;
             } else {
               point.x = position.x;
@@ -200,30 +201,33 @@ export default class MovePoint {
 
   updateBasePoint(position, basePointId) {
     let lineGeometry = dataService.getLine(Settings.baseLineId);
-    let startPoint = dataService.getPoint(lineGeometry.startId);
-    let endPoint = dataService.getPoint(lineGeometry.endId);
-    lineGeometry = mathUtil.createLine1(startPoint, endPoint);
     let basePoint = dataService.getPoint(basePointId);
-    let parent = basePoint.getParent();
-    for (let key in parent) {
-      let line = dataService.getLine(key);
-      if (line.getCategory() == VectorCategory.Line.LocationLineByBasePoint) {
-        let otherPointId = line.getOtherPointId(basePointId);
-        let otherPoint = dataService.getPoint(otherPointId);
-        let otherLine = mathUtil.getLineForPoint(lineGeometry, otherPoint);
-        line = mathUtil.createLine3(lineGeometry, position);
-        let join = mathUtil.getIntersectionPoint(line, otherLine);
-        mathUtil.clonePoint(otherPoint, join);
-      } else if (
-        line.getCategory() == VectorCategory.Line.ExtendedPositionLine
-      ) {
-        let otherPointId = line.getOtherPointId(basePointId);
-        let otherPoint = dataService.getPoint(otherPointId);
-        let otherLine = mathUtil.createLine3(lineGeometry, otherPoint);
-        let join = mathUtil.getJoinLinePoint(position, otherLine);
-        mathUtil.clonePoint(otherPoint, join);
+    if (lineGeometry) {
+      let startPoint = dataService.getPoint(lineGeometry.startId);
+      let endPoint = dataService.getPoint(lineGeometry.endId);
+      lineGeometry = mathUtil.createLine1(startPoint, endPoint);
+      let parent = basePoint.getParent();
+      for (let key in parent) {
+        let line = dataService.getLine(key);
+        if (line.getCategory() == VectorCategory.Line.LocationLineByBasePoint) {
+          let otherPointId = line.getOtherPointId(basePointId);
+          let otherPoint = dataService.getPoint(otherPointId);
+          let otherLine = mathUtil.getLineForPoint(lineGeometry, otherPoint);
+          line = mathUtil.createLine3(lineGeometry, position);
+          let join = mathUtil.getIntersectionPoint(line, otherLine);
+          mathUtil.clonePoint(otherPoint, join);
+        } else if (
+          line.getCategory() == VectorCategory.Line.ExtendedPositionLine
+        ) {
+          let otherPointId = line.getOtherPointId(basePointId);
+          let otherPoint = dataService.getPoint(otherPointId);
+          let otherLine = mathUtil.createLine3(lineGeometry, otherPoint);
+          let join = mathUtil.getJoinLinePoint(position, otherLine);
+          mathUtil.clonePoint(otherPoint, join);
+        }
       }
     }
+
     mathUtil.clonePoint(basePoint, position);
   }