浏览代码

Merge branch 'master' of http://192.168.0.115:3000/bill/traffic-laser

bill 2 年之前
父节点
当前提交
f89a582ba8
共有 4 个文件被更改,包括 24 次插入8 次删除
  1. 2 1
      src/graphic/Controls/MoveLine.js
  2. 13 3
      src/graphic/Controls/MovePoint.js
  3. 4 2
      src/graphic/History/HistoryUtil.js
  4. 5 2
      src/graphic/Layer.js

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

@@ -166,7 +166,7 @@ export default class MoveLine {
     } else {
       if (line.getCategory() == VectorCategory.Line.BaseLine) {
         if (uiService.getSelectLocationMode() == Constant.angleLocationMode) {
-          let msg = locationModeControl.setAngle();
+          let msg = locationModeControl.beforeSetLocation();
           if (msg != Msg.OK) {
             uiService.prompt({ msg: msg, time: 1000 });
           } else {
@@ -174,6 +174,7 @@ export default class MoveLine {
             startPoint.y += dy;
             endPoint.x += dx;
             endPoint.y += dy;
+            locationModeControl.setAngle();
           }
         }
       } else {

+ 13 - 3
src/graphic/Controls/MovePoint.js

@@ -3,6 +3,7 @@ import { pointService } from "../Service/PointService";
 import Settings from "../Settings";
 import Constant from "../Constant";
 import VectorCategory from "../enum/VectorCategory";
+import Msg from "../enum/Msg";
 import { listenLayer } from "../ListenLayer";
 import { uiService } from "../Service/UIService";
 import { mathUtil } from "../Util/MathUtil";
@@ -18,20 +19,29 @@ export default class MovePoint {
     } else if (point.getCategory() == VectorCategory.Point.FixPoint) {
       this.updateFixPoint(position, pointId);
     } else {
-      point.x = position.x;
-      point.y = position.y;
       let parent = point.getParent();
       for (let key in parent) {
         let line = dataService.getLine(key);
         if (line.getCategory() == VectorCategory.Line.BaseLine) {
           if (uiService.getSelectLocationMode() == Constant.angleLocationMode) {
-            locationModeControl.setAngle();
+            let msg = locationModeControl.beforeSetLocation();
+            if (msg != Msg.OK) {
+              uiService.prompt({ msg: msg, time: 1000 });
+              return false;
+            } else {
+              point.x = position.x;
+              point.y = position.y;
+              locationModeControl.setAngle();
+            }
           }
         } else {
+          point.x = position.x;
+          point.y = position.y;
           line.setValue(null);
         }
       }
     }
+    return true;
   }
 
   finish(pointId) {

+ 4 - 2
src/graphic/History/HistoryUtil.js

@@ -85,7 +85,7 @@ export default class HistoryUtil {
       text1.angle == text2.angle &&
       text1.fontSize == text2.fontSize &&
       text1.color == text2.color &&
-      text1.linkedTextId == text2.linkedTextId
+      text1.linkedPointId == text2.linkedPointId
     ) {
       return false;
     } else {
@@ -345,7 +345,7 @@ export default class HistoryUtil {
     pointInfo.parent = JSON.parse(JSON.stringify(point2.parent));
     pointInfo.locationMode = point2.locationMode;
     pointInfo.linkedBasePointId = point2.linkedBasePointId;
-    pointInfo.linkedTextId == point2.linkedTextId;
+    pointInfo.linkedTextId = point2.linkedTextId;
     pointInfo.category = point2.category;
     this.setPointInfo(pointInfo);
   }
@@ -604,6 +604,7 @@ export default class HistoryUtil {
     data.category = point.category;
     data.locationMode = point.locationMode;
     data.linkedBasePointId = point.linkedBasePointId;
+    data.linkedTextId = point.linkedTextId;
     data.type = point.geoType;
     return data;
   }
@@ -665,6 +666,7 @@ export default class HistoryUtil {
     data.center = {};
     mathUtil.clonePoint(data.center, text.center);
     data.value = text.value;
+    data.linkedPointId = text.linkedPointId;
     data.fontSize = text.fontSize;
     data.color = text.color;
     return data;

+ 5 - 2
src/graphic/Layer.js

@@ -900,11 +900,14 @@ export default class Layer {
               y: listenLayer.modifyPoint.y,
             };
           }
-          movePoint.movePoint(position, draggingItem.vectorId);
+          let movePointFlag = movePoint.movePoint(
+            position,
+            draggingItem.vectorId
+          );
           needAutoRedraw = true;
           if (!point) {
             stateService.clearEventName();
-          } else {
+          } else if (movePointFlag) {
             this.showElementLine(point, eventName);
           }
         }