1
0

point-model.js 726 B

123456789101112131415161718
  1. import { GeometricObject } from "../../../core/models/objects/geometric-object";
  2. import { ELEMENTS_CLASS } from "../../../core/enums/elements-class-enum";
  3. export class PointModel extends GeometricObject {
  4. constructor(posX, posY, label, id) {
  5. super(id);
  6. this.posX = posX;
  7. this.posY = posY;
  8. this.setLabel(label);
  9. super.setClass(ELEMENTS_CLASS.POINT);
  10. this.definitions = [{ id: this.posX + 5 }, { id: -this.posY - 5 }];
  11. this.color = -16711936;
  12. }
  13. update(konvaObject, event) {
  14. this.posX = konvaObject.attrs.startPosX + event.target._lastPos.x;
  15. this.posY = konvaObject.attrs.startPosY + event.target._lastPos.y;
  16. this.definitions = [{ id: this.posX + 5 }, { id: -this.posY - 5 }];
  17. }
  18. }