Browse Source

修复bug

xushiting 2 years ago
parent
commit
533d7a3169

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

@@ -7,6 +7,8 @@ import { pointService } from "../Service/PointService";
 import { movePoint } from "./MovePoint";
 import { mathUtil } from "../Util/MathUtil";
 import VectorCategory from "../enum/VectorCategory";
+import { locationModeControl } from "./LocationModeControl";
+import { uiService } from "../Service/UIService";
 
 export default class MoveLine {
   constructor() {}
@@ -243,6 +245,11 @@ export default class MoveLine {
       startPoint.y += dy;
       endPoint.x += dx;
       endPoint.y += dy;
+      if (line.getCategory() == VectorCategory.Line.BaseLine) {
+        if (uiService.getSelectLocationMode() == Constant.angleLocationMode) {
+          locationModeControl.setAngle();
+        }
+      }
     }
     return true;
   }

+ 1 - 1
src/graphic/Controls/MoveText.js

@@ -6,7 +6,7 @@ export default class MoveText {
 
   moveFullText(position, textId) {
     let text = dataService.getText(textId);
-    if (!text.linkedPointId) {
+    if (text && !text.linkedPointId) {
       mathUtil.clonePoint(text.center, position);
     }
   }

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

@@ -117,6 +117,7 @@ export default class UIControl {
         } else if (uiService.isBelongRoadStructure(selectUI)) {
           stateService.setEventName(LayerEvents.AddRoadStructure);
         } else if (selectUI == Constant.angleLocationMode) {
+          uiService.setSelectLocationMode(Constant.angleLocationMode);
           locationModeControl.setAngle();
           this.layer.history.save();
           this.layer.renderer.autoRedraw();

+ 1 - 1
src/graphic/History/History.js

@@ -101,8 +101,8 @@ export default class History {
     if (item) {
       stateService.clear();
       item.type = "pre";
-      this.goPreForLines(item.lines);
       this.goPreForPoints(item.points);
+      this.goPreForLines(item.lines);
       this.goPreForCurvePoints(item.curvePoints);
       this.goPreForCurveLines(item.curveLines);
       this.goPreForCircles(item.circles);

+ 10 - 8
src/graphic/Service/DataService.js

@@ -138,14 +138,16 @@ export class DataService {
       return;
     }
     let start = this.getPoint(line.startId);
-    let startParent = start.getParent();
-    delete startParent[lineId];
-    if (
-      Object.keys(startParent).length == 0 &&
-      start.getCategory() != VectorCategory.Point.BasePoint &&
-      start.getCategory() != VectorCategory.Point.FixPoint
-    ) {
-      this.deletePoint(line.startId);
+    if (start) {
+      let startParent = start.getParent();
+      delete startParent[lineId];
+      if (
+        Object.keys(startParent).length == 0 &&
+        start.getCategory() != VectorCategory.Point.BasePoint &&
+        start.getCategory() != VectorCategory.Point.FixPoint
+      ) {
+        this.deletePoint(line.startId);
+      }
     }
 
     let end = this.getPoint(line.endId);

+ 4 - 23
src/graphic/Service/UIService.js

@@ -79,11 +79,9 @@ export default class UIService {
       return true;
     } else if (ui == UIEvents.Line) {
       this.setSelectLineCategory(VectorCategory.Line.NormalLine);
-      this.setSelectLocationMode(Constant.null);
       return true;
     } else if (ui == UIEvents.FreeMeasureLine) {
       this.setSelectLineCategory(VectorCategory.Line.FreeMeasureLine);
-      this.setSelectLocationMode(Constant.freeLocationMode);
       return true;
     } else if (ui == UIEvents.BaseLine) {
       this.setSelectLineCategory(VectorCategory.Line.BaseLine);
@@ -93,29 +91,8 @@ export default class UIService {
   }
 
   isBelongPoint(ui) {
-    // if (ui == UIEvents.NormalLocationMode) {
-    //   this.setSelectPointCategory(VectorCategory.Point.TestPoint);
-    //   this.setSelectLocationMode(Constant.normalLocationMode);
-    //   return true;
-    // } else if (ui == UIEvents.AngleLocationMode) {
-    //   this.setSelectPointCategory(VectorCategory.Point.TestPoint);
-    //   this.setSelectLocationMode(Constant.angleLocationMode);
-    //   return true;
-    // } else if (ui == UIEvents.AllLocationMode) {
-    //   this.setSelectPointCategory(VectorCategory.Point.TestPoint);
-    //   this.setSelectLocationMode(Constant.allLocationMode);
-    //   return true;
-    // } else if (ui == UIEvents.BasePoint) {
-    //   this.setSelectPointCategory(VectorCategory.Point.BasePoint);
-    //   this.setSelectLocationMode(null);
-    //   return true;
-    // } else if (ui == UIEvents.FixPoint) {
-    //   this.setSelectPointCategory(VectorCategory.Point.FixPoint);
-    //   return true;
-    // }
     if (ui == UIEvents.BasePoint) {
       this.setSelectPointCategory(VectorCategory.Point.BasePoint);
-      this.setSelectLocationMode(null);
       return true;
     } else if (ui == UIEvents.FixPoint) {
       this.setSelectPointCategory(VectorCategory.Point.FixPoint);
@@ -235,6 +212,10 @@ export default class UIService {
     Settings.selectLocationMode = value;
   }
 
+  getSelectLocationMode() {
+    return Settings.selectLocationMode;
+  }
+
   setSelectSVGType(value) {
     Settings.selectSVGType = value;
   }