瀏覽代碼

修复bug

xushiting 2 年之前
父節點
當前提交
8208cf0da8

+ 3 - 1
src/graphic/Controls/AddLine.js

@@ -6,7 +6,9 @@ import Point from "../Geometry/Point.js";
 import { mathUtil } from "../Util/MathUtil";
 import Settings from "../Settings";
 import { pointService } from "../Service/PointService";
+import { uiService } from "../Service/UIService";
 import Constant from "../Constant";
+
 export default class AddLine {
   constructor() {
     this.newLine = null;
@@ -90,7 +92,7 @@ export default class AddLine {
         }
       }
       if (this.newLine.getCategory() == VectorCategory.Line.BaseLine) {
-        Settings.baseLineId = this.newLine.vectorId;
+        uiService.setBaseLineId(this.newLine.vectorId);
       }
     }
   }

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

@@ -644,7 +644,7 @@ export default class UIControl {
   menu_clear(isBack) {
     dataService.clear();
     Settings.selectLocationMode = null;
-    Settings.baseLineId = null;
+    uiService.setBaseLineId(null);
     uiService.setSelectBasePointId(null);
     elementService.hideAll();
     this.layer.exit();

+ 1 - 1
src/graphic/Layer.js

@@ -1399,7 +1399,7 @@ export default class Layer {
   }
 
   initLocation() {
-    Settings.baseLineId = null;
+    uiService.setBaseLineId(null);
     this.uiControl.graphicStateUI.canAngleLocationMode = false;
     this.uiControl.graphicStateUI.canAllLocationMode = false;
     this.uiControl.graphicStateUI.canVerticalMeasure = false;

+ 1 - 1
src/graphic/Load.js

@@ -161,7 +161,7 @@ export default class Load {
 
           line.setDisplay(dataLocal.lines[key].display);
           if (line.getCategory() == VectorCategory.Line.BaseLine) {
-            Settings.baseLineId = key;
+            uiService.setBaseLineId(key);
           }
         }
       }

+ 1 - 1
src/graphic/Service/LineService.js

@@ -58,7 +58,7 @@ export default class LineService {
           dataService.deletePoint(key);
         }
       }
-      Settings.baseLineId = null;
+      uiService.setBaseLineId(null);
     }
     dataService.deleteLine();
   }

+ 4 - 0
src/graphic/Service/PointService.js

@@ -4,6 +4,7 @@ import { dataService } from "./DataService.js";
 import VectorCategory from "../enum/VectorCategory.js";
 import { mathUtil } from "../Util/MathUtil.js";
 import { lineService } from "./LineService.js";
+import { uiService } from "./UIService.js";
 import Settings from "../Settings.js";
 export default class PointService {
   constructor() {}
@@ -92,6 +93,9 @@ export default class PointService {
     let parent = normalPoint.getParent();
     for (let key in parent) {
       dataService.deleteLine(key);
+      if (Settings.baseLineId == key) {
+        uiService.setBaseLineId(null);
+      }
     }
   }
 

+ 8 - 0
src/graphic/Service/UIService.js

@@ -268,6 +268,14 @@ export default class UIService {
     Settings.lineWidth = value;
   }
 
+  setBaseLineId(value) {
+    Settings.baseLineId = value;
+  }
+
+  getBaseLineId() {
+    return Settings.baseLineId;
+  }
+
   //如果position在屏幕左上角,返回的就朝向右下角,如果是右下角,则返回的是左上角。其他情况以此类推
   getNewPositionForPop(position) {
     const offset = 50;