ソースを参照

fix: ponto médio

Victor Luiz Domingues 1 年間 前
コミット
16de6437b3

+ 8 - 3
src/app/components/middle-point/drawers/middle-point-drawer.js

@@ -115,7 +115,6 @@ export class MiddlePointDrawer extends SelectableDrawer {
 
     drawByPoints(points, aggregators) {
         if (points == undefined || points.length < 1) return;
-        console.log("points", points);
         this.setPointA(points[0]);
         this.setPointB(points[1]);
         this.setPointC(points[2]);
@@ -131,12 +130,13 @@ export class MiddlePointDrawer extends SelectableDrawer {
         const group = SelectableDrawer.getKonvaGroup(false);
         const text = MiddlePointDrawer.getKonvaText(middlePoint, middlePoint.label);
         group.add(text);
+        group.add(this.aggregatorC.konvaObject);
         const konvaObject = MiddlePointDrawer.getKonvaLine(middlePoint.pointA, middlePoint.pointB);
         group.add(konvaObject);
         super.setKonvaObject(group);
         const aggregator = new DrawerAggregator(
             this, this.middlePoint,
-            group, ELEMENTS_CLASS.LINE_SEGMENT
+            group, ELEMENTS_CLASS.MIDDLE_POINT
         );
         super.addAggregator(aggregator);
         const aggregators = this.resolveAggregators([this.middlePoint.pointA, this.middlePoint.pointB, this.middlePoint.pointC], undefined);
@@ -179,7 +179,6 @@ export class MiddlePointDrawer extends SelectableDrawer {
         const pointB = aggregator.genericObject.pointB;
         const pointC = aggregator.genericObject.pointC;
         const coord = aggregator.genericObject.getMiddlePoint();
-        console.log(aggregator.konvaObject)
         pointC.bind(coord.posX, coord.posY);
         aggregator.konvaObject.children[0].x(coord.posX);
         aggregator.konvaObject.children[0].y(coord.posY - 20);
@@ -187,6 +186,12 @@ export class MiddlePointDrawer extends SelectableDrawer {
             pointA.posX, pointA.posY,
             pointB.posX, pointB.posY
         ]);
+        const text = aggregator.konvaObject.children[2].children[0]
+        const middlePoint = aggregator.konvaObject.children[2].children[1]
+        text.x(pointC.posX+ 10);
+        text.y(pointC.posY - 10);
+        middlePoint.x(pointC.posX);
+        middlePoint.y(pointC.posY);
         super.batchDraw();
     }
 

+ 0 - 1
src/app/components/point-component/drawers/point-drawer.js

@@ -107,7 +107,6 @@ export class PointDrawer extends SelectableDrawer {
   }
 
   static getKonvaCircle(point, draggable, selectable) {
-    console.log("point", point)
     let fill = draggable == undefined || draggable ? STYLE.fill : STYLE.fill2;
     let stroke = draggable == undefined || draggable ? STYLE.stroke : STYLE.fill2;
 

+ 4 - 2
src/app/core/application/selector.js

@@ -37,11 +37,11 @@ export class Selector {
   }
 
   getSelectedKonvaObjects() {
-    return this.getSelectedAggregators().map(function(aggregator) {
+    return this.getSelectedAggregators().map(function (aggregator) {
       if (aggregator.konvaObject.children == undefined) {
         return aggregator.konvaObject;
       } else {
-        return aggregator.konvaObject.children.map(function(object) {
+        return aggregator.konvaObject.children.map(function (object) {
           return object;
         })[0];
       }
@@ -105,6 +105,7 @@ export class Selector {
   }
 
   style(object, selectorRect, aggregator) {
+    if (object instanceof Konva.Group) return;
     if (object == undefined) return;
     if (object.attrs.selectable != undefined) {
       if (object.attrs.selectable == false) {
@@ -192,6 +193,7 @@ export class Selector {
     });
   }
   clearAggregator(object, aggregator) {
+    if (object instanceof Konva.Group) return;
     if (object == undefined) return;
     if (object.attrs.style != undefined) {
       this.removeObject(aggregator);

BIN
src/assets/images/icons/Middle_Point.png


+ 55 - 0
src/assets/images/icons/Middle_Point.svg

@@ -0,0 +1,55 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40">
+  <metadata><?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
+<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.6-c142 79.160924, 2017/07/13-01:06:39        ">
+   <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
+      <rdf:Description rdf:about=""/>
+   </rdf:RDF>
+</x:xmpmeta>
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                           
+<?xpacket end="w"?></metadata>
+<defs>
+    <style>
+      .cls-1 {
+        fill: #464646;
+        fill-rule: evenodd;
+      }
+
+      .cls-2 {
+        fill: #84bb3a;
+      }
+
+      .cls-3 {
+        fill: #b70e0e;
+      }
+    </style>
+  </defs>
+  <g id="Middle_Point" data-name="Middle Point">
+    <g id="Middle_Point-2" data-name="Middle Point">
+      <path class="cls-1" d="M981,1.458l0.44-.439L1018,37.542l-0.44.439Z" transform="translate(-980)"/>
+      <path class="cls-1" d="M981,1.458l0.44-.439L1018,37.542l-0.44.439Z" transform="translate(-980)"/>
+      <circle class="cls-2" cx="11.61" cy="10.703" r="2.61"/>
+      <circle id="Ellipse_1_copy" data-name="Ellipse 1 copy" class="cls-2" cx="28.39" cy="28.297" r="2.61"/>
+      <circle class="cls-3" cx="19.5" cy="19.5" r="2.5"/>
+    </g>
+  </g>
+</svg>

+ 5 - 0
src/css/icons.css

@@ -29,3 +29,8 @@
 .icon-trash {
   background-image: url("../assets/images/icons/Trash.png");
 }
+
+
+.icon-middle-point {
+  background-image: url("../assets/images/icons/Middle_Point.png");
+}