Browse Source

修复bug

xushiting 2 năm trước cách đây
mục cha
commit
49be630fa1

+ 7 - 2
src/graphic/Geometry/Geometry.js

@@ -110,6 +110,11 @@ export default class Geometry {
   setWeight(weight) {
     this.weight = weight;
   }
+
+  getWeight() {
+    return this.weight;
+  }
+
   setPhotoUrl(src) {
     this.photoUrl = src;
   }
@@ -132,10 +137,10 @@ export default class Geometry {
     this.locationMode = value;
   }
 
-  setLinkedBasePointId(id){
+  setLinkedBasePointId(id) {
     this.linkedBasePointId = id;
   }
-  setLinkedTestPointId(id){
+  setLinkedTestPointId(id) {
     this.linkedTestPointId = id;
   }
 

+ 2 - 0
src/graphic/Layer.js

@@ -312,12 +312,14 @@ export default class Layer {
             );
           } else if (focusItem.type == VectorType.Line) {
             let line = dataService.getLine(focusItem.vectorId);
+            const weight = line.getWeight();
             let startPoint = dataService.getPoint(line.startId);
             let endPoint = dataService.getPoint(line.endId);
             dataService.deleteLine(focusItem.vectorId);
             let curveLine = lineService.createCurveLine(startPoint, endPoint);
             mathUtil.clonePoint(curveLine.points[1], position);
             curveLine.curves = mathUtil.getCurvesByPoints(curveLine.points);
+            curveLine.setWeight(weight);
           } else if (focusItem.type == VectorType.CurveLine) {
             let curveLine = dataService.getCurveLine(focusItem.vectorId);
             let index = mathUtil.getIndexForCurvesPoints(

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

@@ -240,7 +240,9 @@ export default class LineService {
     if (curveLine.points.length == 2) {
       let startPoint = dataService.getCurvePoint(curveLine.startId);
       let endPoint = dataService.getCurvePoint(curveLine.endId);
-      this.create(startPoint, endPoint);
+      let line = this.create(startPoint, endPoint);
+      const weight = curveLine.getWeight();
+      line.setWeight(weight);
       this.deleteCurveLine(curveLineId);
     } else {
       curveLine.curves = mathUtil.getCurvesByPoints(curveLine.points);