Victor Luiz Domingues 1 rok pred
rodič
commit
fe268aa518

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

@@ -39,7 +39,7 @@ export class MiddlePointDrawer extends SelectableDrawer {
         this.states = [MiddlePointDrawer.FIRST_POINT_STATE, MiddlePointDrawer.SECOND_POINT_STATE];
         this.middlePoint;
         this.pointDrawer = new PointDrawer();
-        super.setElementClass(ELEMENTS_CLASS.LINE_SEGMENT);
+        super.setElementClass(ELEMENTS_CLASS.MIDDLE_POINT);
     }
 
     setPointA(point) {
@@ -129,10 +129,9 @@ export class MiddlePointDrawer extends SelectableDrawer {
         this.middlePoint = middlePoint;
         const group = SelectableDrawer.getKonvaGroup(false);
         const text = MiddlePointDrawer.getKonvaText(middlePoint, middlePoint.label);
+        const line = MiddlePointDrawer.getKonvaLine(middlePoint.pointA, middlePoint.pointB);
         group.add(text);
-        group.add(this.aggregatorC.konvaObject);
-        const konvaObject = MiddlePointDrawer.getKonvaLine(middlePoint.pointA, middlePoint.pointB);
-        group.add(konvaObject);
+        group.add(line);
         super.setKonvaObject(group);
         const aggregator = new DrawerAggregator(
             this, this.middlePoint,
@@ -186,9 +185,10 @@ 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);
+        console.log("aggregator-update", aggregator.drawer)
+        const text = aggregator.drawer.aggregatorC.konvaObject.children[0]
+        const middlePoint = aggregator.drawer.aggregatorC.konvaObject.children[1]
+        text.x(pointC.posX + 10);
         text.y(pointC.posY - 10);
         middlePoint.x(pointC.posX);
         middlePoint.y(pointC.posY);

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

@@ -105,7 +105,7 @@ export class Selector {
   }
 
   style(object, selectorRect, aggregator) {
-    if (object instanceof Konva.Group) return;
+    console.log(object)
     if (object == undefined) return;
     if (object.attrs.selectable != undefined) {
       if (object.attrs.selectable == false) {
@@ -193,7 +193,7 @@ export class Selector {
     });
   }
   clearAggregator(object, aggregator) {
-    if (object instanceof Konva.Group) return;
+    console.log("clearAggregator", object)
     if (object == undefined) return;
     if (object.attrs.style != undefined) {
       this.removeObject(aggregator);