Ver código fonte

综合定位和垂线定位,拖动基准线更新位置

jinx 2 anos atrás
pai
commit
1232f2a203

Diferenças do arquivo suprimidas por serem muito extensas
+ 1 - 1
server/test/a0k4xu045_202305311600080410/attach/sceneStore


+ 22 - 23
src/graphic/Controls/MoveLine.js

@@ -1,9 +1,10 @@
-import Constant from "../Constant";
-import { dataService } from "../Service/DataService";
-import { lineService } from "../Service/LineService";
-import { pointService } from "../Service/PointService";
-import { mathUtil } from "../Util/MathUtil";
-import VectorCategory from "../enum/VectorCategory";
+import Constant from '../Constant';
+import { dataService } from '../Service/DataService';
+import { lineService } from '../Service/LineService';
+import { pointService } from '../Service/PointService';
+import { movePoint } from './MovePoint';
+import { mathUtil } from '../Util/MathUtil';
+import VectorCategory from '../enum/VectorCategory';
 
 export default class MoveLine {
   constructor() {}
@@ -16,10 +17,7 @@ export default class MoveLine {
     let endPoint = dataService.getPoint(line.endId);
 
     //垂直移动
-    if (
-      line.getCategory() == VectorCategory.Line.PositionLine &&
-      line.getLocationMode() == Constant.angleLocationMode
-    ) {
+    if (line.getCategory() == VectorCategory.Line.PositionLine && line.getLocationMode() == Constant.angleLocationMode) {
       let point1 = {
         x: startPoint.x + dx,
         y: startPoint.y + dy,
@@ -37,29 +35,21 @@ export default class MoveLine {
           return false;
         }
         let newStartPoint = pointService.create(point1);
-        let extendedPositionLine = lineService.createByPointId(
-          startPoint.vectorId,
-          newStartPoint.vectorId,
-          VectorCategory.Line.ExtendedPositionLine
-        );
+        let extendedPositionLine = lineService.createByPointId(startPoint.vectorId, newStartPoint.vectorId, VectorCategory.Line.ExtendedPositionLine);
         extendedPositionLine.setLocationMode(Constant.angleLocationMode);
         dataService.deletePointParent(startPoint.vectorId, lineId);
         line.startId = newStartPoint.vectorId;
-        newStartPoint.setPointParent(line.vectorId, "start");
+        newStartPoint.setPointParent(line.vectorId, 'start');
         newStartPoint.setCategory(VectorCategory.Point.TestBasePoint);
       } else {
         startPoint.x = point1.x;
         startPoint.y = point1.y;
         let parents = Object.keys(startPoint.parent);
         let extendedLine = dataService.getLine(parents[0]);
-        if (
-          extendedLine.getCategory() != VectorCategory.Line.ExtendedPositionLine
-        ) {
+        if (extendedLine.getCategory() != VectorCategory.Line.ExtendedPositionLine) {
           extendedLine = dataService.getLine(parents[1]);
         }
-        if (
-          extendedLine.getCategory() == VectorCategory.Line.ExtendedPositionLine
-        ) {
+        if (extendedLine.getCategory() == VectorCategory.Line.ExtendedPositionLine) {
           //point1是基准点
           point1 = dataService.getPoint(extendedLine.startId);
           point2 = dataService.getPoint(extendedLine.endId);
@@ -68,7 +58,7 @@ export default class MoveLine {
             dataService.deletePoint(extendedLine.endId);
 
             line.startId = point1.vectorId;
-            point1.setPointParent(line.vectorId, "start");
+            point1.setPointParent(line.vectorId, 'start');
 
             lineGeometry = mathUtil.createLine3(lineGeometry, point1);
           }
@@ -79,6 +69,15 @@ export default class MoveLine {
       endPoint.x = point2.x;
       endPoint.y = point2.y;
     } else {
+      //综合定位和垂线定位,拖动基准线更新位置
+      if (line.getCategory() == VectorCategory.Line.BaseLine) {
+        let points = dataService.vectorData.points;
+        for (let key in points) {
+          if (points[key].category == VectorCategory.Point.TestPoint && (points[key].locationMode == Constant.allLocationMode || points[key].locationMode == Constant.normalLocationMode)) {
+            movePoint.updatePositionByTestPoint(points[key].vectorId);
+          }
+        }
+      }
       startPoint.x += dx;
       startPoint.y += dy;
       endPoint.x += dx;

+ 0 - 3
src/graphic/Renderer/Draw.js

@@ -26,7 +26,6 @@ const help = {
     ];
     let currentAttr;
 
-    console.log(itemsEntry)
     return [
       itemsEntry.reduce((prev, [item, attr]) => {
         if (!item) return prev;
@@ -963,7 +962,6 @@ export default class Draw {
       };
     }
 
-    console.log(vector, style, Settings.selectBasePointId)
     draw(style);
     if (style.out) {
       draw(style.out);
@@ -1050,7 +1048,6 @@ export default class Draw {
     const dires = [points[0], { ...points[0], x: 10000 }, points[1]];
     let angle = mathUtil.Angle(...dires) * (Math.PI / 180);
     angle = mathUtil.isClockwise(dires) ? angle : -angle;
-    console.log(angle)
     this.context.save();
     this.context.translate(points[0].x, points[0].y);
     this.context.rotate(angle);