Browse Source

fix: middle point

Victor Luiz Domingues 1 year ago
parent
commit
1cb1207704

+ 2 - 0
src/app/components/intersection-component/drawers/intersection-drawer.js

@@ -108,6 +108,8 @@ export class IntersectionDrawer extends Drawer {
         return true;
         return true;
       case ELEMENTS_CLASS.CIRCUMFERENCE:
       case ELEMENTS_CLASS.CIRCUMFERENCE:
         return true;
         return true;
+        case ELEMENTS_CLASS.MIDDLE_POINT:
+          return true;
       default:
       default:
         return false;
         return false;
     }
     }

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

@@ -178,20 +178,26 @@ export class MiddlePointDrawer extends SelectableDrawer {
         const pointB = aggregator.genericObject.pointB;
         const pointB = aggregator.genericObject.pointB;
         const pointC = aggregator.genericObject.pointC;
         const pointC = aggregator.genericObject.pointC;
         const coord = aggregator.genericObject.getMiddlePoint();
         const coord = aggregator.genericObject.getMiddlePoint();
-        pointC.bind(coord.posX, coord.posY);
         aggregator.konvaObject.children[0].x(coord.posX);
         aggregator.konvaObject.children[0].x(coord.posX);
         aggregator.konvaObject.children[0].y(coord.posY - 20);
         aggregator.konvaObject.children[0].y(coord.posY - 20);
         aggregator.konvaObject.children[1].points([
         aggregator.konvaObject.children[1].points([
             pointA.posX, pointA.posY,
             pointA.posX, pointA.posY,
             pointB.posX, pointB.posY
             pointB.posX, pointB.posY
         ]);
         ]);
-        console.log("aggregator-update", aggregator.drawer)
-        const text = aggregator.drawer.aggregatorC.konvaObject.children[0]
-        const middlePoint = aggregator.drawer.aggregatorC.konvaObject.children[1]
+        const aggregatorC = aggregator.drawer.aggregatorC;
+        const middlePointKonvaObject = aggregatorC.konvaObject
+        pointC.bind(coord.posX, coord.posY, pointA.label);
+        const text = middlePointKonvaObject.children[0]
+        const middlePoint = middlePointKonvaObject.children[1]
         text.x(pointC.posX + 10);
         text.x(pointC.posX + 10);
         text.y(pointC.posY - 10);
         text.y(pointC.posY - 10);
         middlePoint.x(pointC.posX);
         middlePoint.x(pointC.posX);
         middlePoint.y(pointC.posY);
         middlePoint.y(pointC.posY);
+        const aggregators = aggregatorC.aggregators.filter(x => !(x.drawer instanceof MiddlePointDrawer))
+        for (let i = 0; i < aggregators.length; i++) {
+            console.log("i", aggregators[i])
+            aggregators[i].drawer.update(aggregators[i], e)
+        }
         super.batchDraw();
         super.batchDraw();
     }
     }
 
 

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

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