SAnchorItem.js 961 B

12345678910111213141516171819202122232425262728
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.SAnchorItem = void 0;
  4. const lib_1 = require("@persagy-web/draw/lib");
  5. const SGraphItem_1 = require("../SGraphItem");
  6. const uuid_1 = require("uuid");
  7. class SAnchorItem extends SGraphItem_1.SGraphItem {
  8. constructor(parent = null) {
  9. super(parent);
  10. this.width = 3;
  11. this.height = 3;
  12. this.isConnected = false;
  13. this.dis = 3;
  14. this.sceneDis = 3;
  15. this.id = uuid_1.v1();
  16. }
  17. onDraw(painter) {
  18. this.sceneDis = painter.toPx(this.dis);
  19. painter.pen.lineWidth = painter.toPx(1);
  20. painter.pen.color = new lib_1.SColor("#2196f3");
  21. painter.brush.color = lib_1.SColor.White;
  22. if (this.isConnected) {
  23. painter.brush.color = painter.pen.color;
  24. }
  25. painter.drawRect(-this.width / 2, -this.height / 2, this.width, this.height);
  26. }
  27. }
  28. exports.SAnchorItem = SAnchorItem;