123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- import VectorType from "../enum/VectorType.js";
- import Geometry from "./Geometry";
- // 二次贝塞尔曲线
- // var ctx=c.getContext("2d");
- // ctx.beginPath();
- // ctx.moveTo(200,20);
- // ctx.quadraticCurveTo(20,100,20,20);
- // ctx.stroke();
- export default class ControlPoint extends Geometry {
- constructor(position, vectorId) {
- super();
- //控制点坐标
- this.x = null;
- this.y = null;
- this.edgeInfo1 = {
- id: null,
- dir: null,
- };
- this.edgeInfo2 = {
- id: null,
- dir: null,
- };
- this.geoType = VectorType.ControlPoint;
- this.setId(vectorId);
- this.setPosition(position);
- }
- setPosition(position) {
- this.x = position.x;
- this.y = position.y;
- }
- setEdgeInfo(edgeId1, dir1, edgeId2, dir2) {
- this.edgeInfo1.id = edgeId1;
- this.edgeInfo1.dir = dir1;
- this.edgeInfo2.id = edgeId2;
- this.edgeInfo2.dir = dir2;
- }
- }
|