فهرست منبع

feat 垂直测量无限测量

jinx 2 سال پیش
والد
کامیت
35c7df89a0
2فایلهای تغییر یافته به همراه40 افزوده شده و 12 حذف شده
  1. 11 3
      src/graphic/Controls/AddPoint.js
  2. 29 9
      src/graphic/Layer.js

+ 11 - 3
src/graphic/Controls/AddPoint.js

@@ -39,21 +39,28 @@ export default class AddPoint {
         this.setLocationByAll(newPoint.vectorId);
         this.setLocationByAll(newPoint.vectorId);
         newPoint.setLocationMode(Constant.allLocationMode);
         newPoint.setLocationMode(Constant.allLocationMode);
         stateService.setEventName(LayerEvents.AddPoint);
         stateService.setEventName(LayerEvents.AddPoint);
-      } else if (Settings.selectLocationMode == Constant.normalLocationMode) {
+      } else if (
+        Settings.selectBasePointId != null && 
+        Settings.selectLocationMode == Constant.normalLocationMode
+        ) {
         newPoint = pointService.create(position);
         newPoint = pointService.create(position);
         this.setLocationByNormal(newPoint.vectorId);
         this.setLocationByNormal(newPoint.vectorId);
         newPoint.setLocationMode(Constant.normalLocationMode);
         newPoint.setLocationMode(Constant.normalLocationMode);
+
+      
+        stateService.setEventName(LayerEvents.AddPoint);
       } else if (
       } else if (
         Settings.selectBasePointId == null &&
         Settings.selectBasePointId == null &&
         (Settings.selectLocationMode == Constant.angleLocationMode ||
         (Settings.selectLocationMode == Constant.angleLocationMode ||
           Settings.selectLocationMode == Constant.allLocationMode)
           Settings.selectLocationMode == Constant.allLocationMode)
       ) {
       ) {
-        return null;
+        // return null;
       }
       }
       if (
       if (
         newPoint &&
         newPoint &&
         (newPoint.getLocationMode() == Constant.allLocationMode ||
         (newPoint.getLocationMode() == Constant.allLocationMode ||
-          newPoint.getLocationMode() == Constant.angleLocationMode) &&
+          newPoint.getLocationMode() == Constant.angleLocationMode || 
+          newPoint.getLocationMode() == Constant.normalLocationMode) &&
         newPoint.getCategory() == VectorCategory.Point.TestPoint
         newPoint.getCategory() == VectorCategory.Point.TestPoint
       ) {
       ) {
         this.testPointIds.push(newPoint.vectorId);
         this.testPointIds.push(newPoint.vectorId);
@@ -181,6 +188,7 @@ export default class AddPoint {
   }
   }
 
 
   deleteTestPoints() {
   deleteTestPoints() {
+    console.log(this.testPointIds)
     for (let i = 0; i < this.testPointIds.length; ++i) {
     for (let i = 0; i < this.testPointIds.length; ++i) {
       pointService.deletePoint(this.testPointIds[i]);
       pointService.deletePoint(this.testPointIds[i]);
     }
     }

+ 29 - 9
src/graphic/Layer.js

@@ -329,6 +329,7 @@ export default class Layer {
     }
     }
     selectItem = stateService.getSelectItem();
     selectItem = stateService.getSelectItem();
     stateService.setDraggingItem(selectItem);
     stateService.setDraggingItem(selectItem);
+    console.log(selectItem)
     // 清除上一个状态
     // 清除上一个状态
     // 设置当前事件名称
     // 设置当前事件名称
     e.preventDefault();
     e.preventDefault();
@@ -937,7 +938,7 @@ export default class Layer {
       y: Y,
       y: Y,
     });
     });
     let needAutoRedraw = false;
     let needAutoRedraw = false;
-
+    console.error(eventName)
     switch (eventName) {
     switch (eventName) {
       case null:
       case null:
         return;
         return;
@@ -1103,13 +1104,26 @@ export default class Layer {
         this.history.save();
         this.history.save();
         break;
         break;
       case LayerEvents.MovePoint:
       case LayerEvents.MovePoint:
-        needAutoRedraw = true;
-        if (draggingItem && draggingItem.vectorId) {
-          movePoint.finish(draggingItem.vectorId);
-          uiService.setSelectPointCategory(VectorCategory.Point.NormalPoint);
+        console.error(Settings)
+
+        if (
+          Settings.selectBasePointId != null &&
+          Settings.selectLocationMode == Constant.normalLocationMode 
+        ) {
+          this.uiControl.showConfirm();
+          needAutoRedraw = true;
+          elementService.hideAll();
+        }else{
+          needAutoRedraw = true;
+          if (draggingItem && draggingItem.vectorId) {
+            movePoint.finish(draggingItem.vectorId);
+            uiService.setSelectPointCategory(VectorCategory.Point.NormalPoint);
+          }
+          this.history.save();
+          elementService.hideAll();
         }
         }
-        this.history.save();
-        elementService.hideAll();
+
+  
         break;
         break;
       case LayerEvents.MoveCurvePoint:
       case LayerEvents.MoveCurvePoint:
         needAutoRedraw = true;
         needAutoRedraw = true;
@@ -1127,7 +1141,9 @@ export default class Layer {
         if (
         if (
           Settings.selectBasePointId != null &&
           Settings.selectBasePointId != null &&
           (Settings.selectLocationMode == Constant.angleLocationMode ||
           (Settings.selectLocationMode == Constant.angleLocationMode ||
-            Settings.selectLocationMode == Constant.allLocationMode)
+            Settings.selectLocationMode == Constant.allLocationMode || 
+            Settings.selectLocationMode == Constant.normalLocationMode 
+          )
         ) {
         ) {
           this.uiControl.showConfirm();
           this.uiControl.showConfirm();
           needAutoRedraw = true;
           needAutoRedraw = true;
@@ -1431,7 +1447,9 @@ export default class Layer {
         eventName == LayerEvents.AddPoint &&
         eventName == LayerEvents.AddPoint &&
         Settings.selectBasePointId != null &&
         Settings.selectBasePointId != null &&
         (Settings.selectLocationMode == Constant.angleLocationMode ||
         (Settings.selectLocationMode == Constant.angleLocationMode ||
-          Settings.selectLocationMode == Constant.allLocationMode)
+          Settings.selectLocationMode == Constant.allLocationMode  ||
+          Settings.selectLocationMode == Constant.normalLocationMode 
+          )
       ) {
       ) {
       } else {
       } else {
         stateService.clearEventName();
         stateService.clearEventName();
@@ -1478,10 +1496,12 @@ export default class Layer {
       this.uiControl.graphicStateUI.canAngleLocationMode = true;
       this.uiControl.graphicStateUI.canAngleLocationMode = true;
       this.uiControl.graphicStateUI.canAllLocationMode = true;
       this.uiControl.graphicStateUI.canAllLocationMode = true;
       this.uiControl.graphicStateUI.existsBaseLine = true;
       this.uiControl.graphicStateUI.existsBaseLine = true;
+      this.uiControl.graphicStateUI.canVerticalMeasure = true;
     } else {
     } else {
       this.uiControl.graphicStateUI.canAngleLocationMode = false;
       this.uiControl.graphicStateUI.canAngleLocationMode = false;
       this.uiControl.graphicStateUI.canAllLocationMode = false;
       this.uiControl.graphicStateUI.canAllLocationMode = false;
       this.uiControl.graphicStateUI.existsBaseLine = false;
       this.uiControl.graphicStateUI.existsBaseLine = false;
+      this.uiControl.graphicStateUI.canVerticalMeasure = false;
     }
     }
   }
   }