Browse Source

registry intersection component, bugfix in selector

Victor Luiz Domingues 5 years ago
parent
commit
ca5c1e5e0f

+ 15 - 0
src/app/component-registry/intersection-component.js

@@ -0,0 +1,15 @@
+import { Component } from "../core/models/components/component";
+import { ComponentOptions } from "../core/models/components/component-options";
+import { IntersectionDrawer } from "../components/intersection-component/drawers/intersection-drawer";
+export class IntersectionComponent extends Component {
+  constructor() {
+    const options = new ComponentOptions(
+      "e60c06bc485546fe89f3565e9f8758e7",
+      "Intersection",
+      "intersection"
+    );
+    super(new IntersectionDrawer(), options);
+  }
+}
+
+export const intersectionComponent = new IntersectionComponent();

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

@@ -0,0 +1,24 @@
+import { PointDrawer } from "../../point-component/drawers/point-drawer";
+
+export class IntersectionDrawer extends PointDrawer {
+  static FIRST_OBJECT_STATE() {
+    return "FIRST_OBJECT";
+  }
+  static SECOND_OBJECT_STATE() {
+    return "SECOND_OBJECTf";
+  }
+  constructor() {
+    super();
+    this.objectA;
+    this.objectB;
+    this.aggregatorA;
+    this.aggregatorB;
+    this.label;
+    this.states = [
+      IntersectionDrawer.FIRST_OBJECT_STATE,
+      IntersectionDrawer.SECOND_OBJECT_STATE
+    ];
+    this.intersections = [];
+    this.pointDrawer = new PointDrawer();
+  }
+}

+ 9 - 0
src/app/components/intersection-component/models/intersection-model.js

@@ -0,0 +1,9 @@
+import { PointModel } from "../../point-component/models/point-model";
+
+export class IntersectionModel extends PointModel {
+  constructor(posX, posY) {
+    this.dependencies = [];
+    this.posX = posX;
+    this.posY = posY;
+  }
+}

+ 1 - 4
src/app/components/line-segment-component/drawers/line-segment-drawer.js

@@ -44,6 +44,7 @@ export class LineSegmentDrawer extends Drawer {
 
   draw() {
     const points = Selector.getSelectedPoints();
+
     if (points == undefined || points.length < 1) {
       this.drawByState();
     }
@@ -120,7 +121,6 @@ export class LineSegmentDrawer extends Drawer {
   }
 
   insertPoint(aggregator) {
-    console.info("aggregator", aggregator);
     const pointA = aggregator.genericObject.pointA;
     const pointB = aggregator.genericObject.pointB;
     const pointCAggregator = this.pointDrawer.drawPoint();
@@ -155,10 +155,7 @@ export class LineSegmentDrawer extends Drawer {
     return line;
   }
   static configureLineEvents(line) {
-    console.info("configureLine");
     line.on("click tap", function(e) {
-      console.info("linha clicada", e);
-      console.info("linha clicada", this);
       this.pointDrawer.drawPoint();
     });
     return line;

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

@@ -5,7 +5,6 @@ import { app as App } from "../../../app";
 import { PointModel } from "../models/point-model";
 import { DrawerAggregator } from "../../../core/drawers/drawer-aggregator";
 import { stageManager as Stages } from "../../../core/application/stage-manager";
-import { LineSegmentDrawer } from "../../line-segment-component/drawers/line-segment-drawer";
 import { objects } from "../../../core/application/objects";
 
 const HOVER_STYLE = {

+ 1 - 1
src/app/core/drawers/layer.js

@@ -34,7 +34,7 @@ export class Layer {
     }
   }
   removeSelectedAggregator(aggregator) {
-    if (!this.selectedAggregators.includes(aggregator)) {
+    if (this.selectedAggregators.includes(aggregator)) {
       var index = this.selectedAggregators.indexOf(aggregator);
       this.selectedAggregators.splice(index, 1);
     }

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


+ 55 - 0
src/assets/images/icons/Intersection.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: none;
+        stroke: #7b7b7b;
+        stroke-width: 1px;
+        stroke-dasharray: 4 2;
+      }
+
+      .cls-2, .cls-3 {
+        fill: #464646;
+      }
+
+      .cls-3 {
+        fill-rule: evenodd;
+      }
+    </style>
+  </defs>
+  <g id="Intersection">
+    <g id="Intersection-2" data-name="Intersection">
+      <circle class="cls-1" cx="17.5" cy="17.5" r="8.5"/>
+      <circle class="cls-2" cx="24" cy="22" r="4"/>
+      <path id="Rectangle_2_copy" data-name="Rectangle 2 copy" class="cls-3" d="M435,30.53l17.51-16.54,0.483,0.481-17.51,16.54Z" transform="translate(-420)"/>
+    </g>
+  </g>
+</svg>