SBoardItem.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.SBoardItem = void 0;
  4. const lib_1 = require("@persagy-web/draw/lib");
  5. const __1 = require("../..");
  6. const lib_2 = require("@persagy-web/graph/lib");
  7. class SBoardItem extends lib_2.SGraphItem {
  8. constructor(parent, data) {
  9. super(parent);
  10. this.pointArr = [];
  11. this.pathList = [];
  12. this.data = data;
  13. this.zOrder = 0;
  14. if (this.data.OutLine.length &&
  15. this.data.OutLine[0] &&
  16. this.data.OutLine[0].length) {
  17. let tempArr = this.data.OutLine;
  18. this.pointArr = tempArr.map((t) => {
  19. let sPath = new lib_1.SPath2D();
  20. let tempArr = t.map((it) => {
  21. let array = it.map((item) => {
  22. let x = item.X, y = -item.Y;
  23. return new lib_1.SPoint(x, y);
  24. });
  25. sPath.polygon(array);
  26. return array;
  27. });
  28. this.pathList.push(sPath);
  29. return tempArr;
  30. });
  31. }
  32. }
  33. contains(x, y) {
  34. return false;
  35. }
  36. onDraw(painter) {
  37. painter.pen.lineWidth = painter.toPx(1);
  38. painter.brush.color = __1.ItemColor.spaceColor;
  39. painter.pen.color = __1.ItemColor.spaceBorderColor;
  40. this.pathList.forEach((t) => {
  41. painter.drawPath(t);
  42. });
  43. }
  44. }
  45. exports.SBoardItem = SBoardItem;