xushiting 2 år sedan
förälder
incheckning
c4ca03b7e4
2 ändrade filer med 27 tillägg och 0 borttagningar
  1. 13 0
      src/graphic/Controls/MoveSVG.js
  2. 14 0
      src/graphic/Geometry/SVG.js

+ 13 - 0
src/graphic/Controls/MoveSVG.js

@@ -22,6 +22,19 @@ export default class MoveSVG {
     svg.scale = (side2 / side1) * scale;
     svg.setBoundingVertexs();
   }
+
+  // movePoint(position, svgId, pointIndex) {
+  //   let svg = dataService.getSVG(svgId);
+  //   const rec = svg.getLengthWidth();
+  //   const scale = svg.getScale();
+  //   const side1 = Math.sqrt(
+  //     Math.pow((rec.width / 2) * scale, 2) +
+  //       Math.pow((rec.length / 2) * scale, 2)
+  //   );
+  //   const side2 = mathUtil.getDistance(position, svg.center);
+  //   svg.scale = (side2 / side1) * scale;
+  //   svg.setBoundingVertexs();
+  // }
 }
 
 const moveSVG = new MoveSVG();

+ 14 - 0
src/graphic/Geometry/SVG.js

@@ -91,6 +91,20 @@ export default class SVG extends Geometry {
     this.points.push(point4);
   }
 
+  // setBoundingVertexs2(position, pointIndex) {
+  //   mathUtil.clonePoint(this.points[pointIndex], position);
+  //   // 【注意】angle 逆时针为正,顺时针为负
+  //   this.points[pointIndex] = this.rotatePoint(position, this.center, 90);
+  // }
+
+  getNextIndex(index) {
+    let nextIndex = index + 1;
+    if (nextIndex > 3) {
+      nextIndex = nextIndex - 4;
+    }
+    return nextIndex;
+  }
+
   //不同图例,缩放比不一样
   getScale() {
     return 1;