Ver código fonte

fix: ponto médio

Victor Luiz Domingues 1 ano atrás
pai
commit
8f65b943ec

+ 13 - 0
src/app/components/middle-point/drawers/middle-point-drawer.js

@@ -65,22 +65,35 @@ export class MiddlePointDrawer extends SelectableDrawer {
     }
 
     draw(e) {
+        console.log("a")
         if (e != undefined) {
             if (e.target != undefined && e.target.attrs.class != undefined &&
                 (e.target.attrs.class == ELEMENTS_CLASS.POINT || e.target.attrs.class == ELEMENTS_CLASS.INTERSECTION_POINT)) {
+                console.log("b")
                 this.drawByStates(e.target);
                 return;
             }
             else if (e.attrs != undefined && e.attrs.genericObject != undefined) {
+                console.log("c")
                 this.drawByMiddlePoint(e.attrs.genericObject)
                 return;
             }
         }
+
         const points = Selector.getSelectedPoints();
         if (points == undefined || points.length == 0) {
             this.drawByStates();
             return;
         }
+        const pointA = points[0];
+        const pointB = points[1];
+        const coord = MiddlePointModel.getMiddlePointPos(pointA, pointB);
+        const pointC = new PointModel(coord.posX, coord.posY, Label.draw());
+        pointC.draggable = false;
+        pointC.backgroundColor = "#f54260";
+        const aggregatorC = this.pointDrawer.drawPoint(pointC);
+        this.setAggregatorC(aggregatorC);
+        points.push(pointC);
         this.drawByPoints(points);
     }