Ver Fonte

Update 'src/app/components/point-component/models/point-model.js'

Added explaining comments (about list of dependents) and adjusts in indentation
leo há 2 meses atrás
pai
commit
900697ab66
1 ficheiros alterados com 15 adições e 12 exclusões
  1. 15 12
      src/app/components/point-component/models/point-model.js

+ 15 - 12
src/app/components/point-component/models/point-model.js

@@ -10,46 +10,49 @@
 import { GeometricObject } from "../../../core/models/objects/geometric-object";
 import { ELEMENTS_CLASS } from "../../../core/enums/elements-class-enum";
 
+// Point extends GeometricObject (app/core/models/objects/geometric-object.js)
 export class PointModel extends GeometricObject {
 
+  // Construct one free Point
   // @param {number  } posX X Position ex: (38.5) float precision
   // @param {number  } posY Y Position  ex: (-38.5) float precision
   // @param {string  } label  Label ex: (P)
-  constructor(posX, posY, label, id) {
+  constructor (posX, posY, label, id) {
     super(id);
-    this.posX = posX;
-    this.posY = posY;
-    this.setLabel(label);
+    this.posX = posX; // initial X coord. of this point
+    this.posY = posY; // initial Y coord. of this point
+    this.setLabel(label); // label of this point
     super.setClass(ELEMENTS_CLASS.POINT);
     this.definitions = [{ id: this.posX + 5 }, { id: -this.posY - 5 }];
     this.color = -16711936;
-  }
+    }
 
+  // Update this point (when its coord. is changed)
   // @param {konvaObject  } Object of Konva Library
   // @param {*  } event 
-  update(konvaObject, event) {
+  update (konvaObject, event) {
     this.posX = konvaObject.attrs.startPosX + event.target._lastPos.x;
     this.posY = konvaObject.attrs.startPosY + event.target._lastPos.y;
     this.definitions = [{ id: this.posX + 5 }, { id: -this.posY - 5 }];
-  }
+    }
 
-  bind(posX, posY, label) {
+  bind (posX, posY, label) {
     this.posX = posX;
     this.posY = posY;
     this.definitions = [{ id: this.posX + 5 }, { id: -this.posY - 5 }];
     if (label != undefined)
       this.setLabel(label);
-  }
+    }
 
   // Create new Intersection By Line of Script .geo
   // @param {Map  } map JavaScript Map
   // @param {List  } list List of Generic Objects
-  static do(map, list) {
+  static do (map, list) {
     const id = map.get("id");
     const x = map.get("param")[0] - 5;
     const y = -map.get("param")[1] + 5;
     const label = map.get("label")[0];
     return new PointModel(x, y, label, id);
-  }
+    }
 
-}
+  }