mxdraw 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/README.md +19 -15
  2. package/dist/lib/MxModule/McEdGetPointWorldDrawObject/McEdGetPointWorldDrawObjectClass.js +0 -1
  3. package/dist/lib/MxModule/McEdGetPointWorldDrawObject/index.js +0 -1
  4. package/dist/lib/MxModule/McGiWorldDraw/McGiWorldDraw.js +0 -1
  5. package/dist/lib/MxModule/McGiWorldDraw/index.js +0 -1
  6. package/dist/lib/MxModule/McGiWorldDrawType/McGiWorldDrawType.js +0 -1
  7. package/dist/lib/MxModule/McGiWorldDrawType/index.js +0 -1
  8. package/dist/lib/MxModule/MrxDbgUiPrBaseReturn/MrxDbgUiPrBaseReturn.js +0 -1
  9. package/dist/lib/MxModule/MrxDbgUiPrBaseReturn/index.js +0 -1
  10. package/dist/lib/MxModule/MrxDbgUiPrPoint/MrxDbgUiPrPointClass.js +0 -1
  11. package/dist/lib/MxModule/MrxDbgUiPrPoint/index.js +0 -1
  12. package/dist/lib/MxModule/MxDbEntity/MxDbEntity.js +60 -8
  13. package/dist/lib/MxModule/MxDbEntity/index.js +0 -1
  14. package/dist/lib/MxModule/MxDrawObject/MxDrawObject.js +93 -3
  15. package/dist/lib/MxModule/MxDrawObject/index.js +0 -1
  16. package/dist/lib/MxModule/MxFun/MxFun.js +53 -10
  17. package/dist/lib/MxModule/MxFun/index.js +0 -1
  18. package/dist/lib/MxModule/MxThreeJS/MxThreeJS.js +5 -35
  19. package/dist/lib/MxModule/MxThreeJS/MxThreeJS.mixin.js +71 -29
  20. package/dist/lib/MxModule/MxThreeJS/SVGLoader.js +4 -5
  21. package/dist/lib/MxModule/MxThreeJS/index.js +0 -1
  22. package/dist/lib/MxModule/MxType/MxType.js +27 -0
  23. package/dist/lib/MxModule/MxType/index.js +4 -0
  24. package/dist/lib/MxModule/loadCoreCode/index.js +0 -1
  25. package/dist/lib/MxModule/loadCoreCode/loadCoreCode.js +0 -1
  26. package/dist/lib/MxModule/loadCoreCode/mxfun.es5.js +714 -661
  27. package/dist/lib/MxModule/store/PubsubClass.js +0 -1
  28. package/dist/lib/MxModule/store/StoreClass.js +0 -1
  29. package/dist/lib/MxModule/store/index.js +0 -1
  30. package/dist/lib/MxModule/store/store.js +0 -1
  31. package/dist/lib/MxModule/useCanvasResizeListener/index.js +0 -1
  32. package/dist/lib/MxModule/useCanvasResizeListener/useCanvasResizeListener.js +0 -1
  33. package/dist/lib/doc.js +0 -1
  34. package/dist/lib/mxdraw.js +3 -2
  35. package/dist/lib/tools/algorithm/math.js +0 -1
  36. package/dist/lib/tools/algorithm/random.js +0 -1
  37. package/dist/lib/tools/dom/create.js +0 -1
  38. package/dist/lib/tools/dynamicImport/index.js +0 -1
  39. package/dist/lib/tools/formatting/index.js +0 -1
  40. package/dist/lib/tools/proxy/index.js +0 -1
  41. package/dist/lib/tools/three/index.js +0 -1
  42. package/dist/lib/types/McEdGetPointWorldDrawObject.js +0 -1
  43. package/dist/lib/types/MrxDbgUiPrPoint.js +0 -1
  44. package/dist/lib/types/MxCADObject.js +0 -1
  45. package/dist/lib/types/MxDrawObject.js +0 -1
  46. package/dist/lib/types/MxFun.js +0 -1
  47. package/dist/mxdraw.es5.js +3 -3
  48. package/dist/mxdraw.es5.js.map +1 -1
  49. package/dist/mxdraw.umd.js +3 -3
  50. package/dist/mxdraw.umd.js.map +1 -1
  51. package/dist/types/MxModule/McGiWorldDraw/McGiWorldDraw.d.ts +72 -1
  52. package/dist/types/MxModule/MxDbEntity/MxDbEntity.d.ts +44 -5
  53. package/dist/types/MxModule/MxDrawObject/MxDrawObject.d.ts +78 -1
  54. package/dist/types/MxModule/MxFun/MxFun.d.ts +48 -10
  55. package/dist/types/MxModule/MxThreeJS/MxThreeJS.d.ts +6 -9
  56. package/dist/types/MxModule/MxType/MxType.d.ts +24 -0
  57. package/dist/types/MxModule/MxType/index.d.ts +2 -0
  58. package/dist/types/mxdraw.d.ts +2 -1
  59. package/dist/types/types/MxDrawObject.d.ts +11 -4
  60. package/dist/types/types/MxFun.d.ts +7 -3
  61. package/package.json +3 -3
  62. package/dist/lib/MxModule/McEdGetPointWorldDrawObject/McEdGetPointWorldDrawObjectClass.js.map +0 -1
  63. package/dist/lib/MxModule/McEdGetPointWorldDrawObject/index.js.map +0 -1
  64. package/dist/lib/MxModule/McGiWorldDraw/McGiWorldDraw.js.map +0 -1
  65. package/dist/lib/MxModule/McGiWorldDraw/index.js.map +0 -1
  66. package/dist/lib/MxModule/McGiWorldDrawType/McGiWorldDrawType.js.map +0 -1
  67. package/dist/lib/MxModule/McGiWorldDrawType/index.js.map +0 -1
  68. package/dist/lib/MxModule/MrxDbgUiPrBaseReturn/MrxDbgUiPrBaseReturn.js.map +0 -1
  69. package/dist/lib/MxModule/MrxDbgUiPrBaseReturn/index.js.map +0 -1
  70. package/dist/lib/MxModule/MrxDbgUiPrPoint/MrxDbgUiPrPointClass.js.map +0 -1
  71. package/dist/lib/MxModule/MrxDbgUiPrPoint/index.js.map +0 -1
  72. package/dist/lib/MxModule/MxDbEntity/MxDbEntity.js.map +0 -1
  73. package/dist/lib/MxModule/MxDbEntity/index.js.map +0 -1
  74. package/dist/lib/MxModule/MxDrawObject/MxDrawObject.js.map +0 -1
  75. package/dist/lib/MxModule/MxDrawObject/index.js.map +0 -1
  76. package/dist/lib/MxModule/MxFun/MxFun.js.map +0 -1
  77. package/dist/lib/MxModule/MxFun/index.js.map +0 -1
  78. package/dist/lib/MxModule/MxThreeJS/MxThreeJS.js.map +0 -1
  79. package/dist/lib/MxModule/MxThreeJS/MxThreeJS.mixin.js.map +0 -1
  80. package/dist/lib/MxModule/MxThreeJS/SVGLoader.js.map +0 -1
  81. package/dist/lib/MxModule/MxThreeJS/index.js.map +0 -1
  82. package/dist/lib/MxModule/loadCoreCode/index.js.map +0 -1
  83. package/dist/lib/MxModule/loadCoreCode/loadCoreCode.js.map +0 -1
  84. package/dist/lib/MxModule/loadCoreCode/mxfun.es5.js.map +0 -1
  85. package/dist/lib/MxModule/store/PubsubClass.js.map +0 -1
  86. package/dist/lib/MxModule/store/StoreClass.js.map +0 -1
  87. package/dist/lib/MxModule/store/index.js.map +0 -1
  88. package/dist/lib/MxModule/store/store.js.map +0 -1
  89. package/dist/lib/MxModule/useCanvasResizeListener/index.js.map +0 -1
  90. package/dist/lib/MxModule/useCanvasResizeListener/useCanvasResizeListener.js.map +0 -1
  91. package/dist/lib/doc.js.map +0 -1
  92. package/dist/lib/mxdraw.js.map +0 -1
  93. package/dist/lib/tools/algorithm/math.js.map +0 -1
  94. package/dist/lib/tools/algorithm/random.js.map +0 -1
  95. package/dist/lib/tools/dom/create.js.map +0 -1
  96. package/dist/lib/tools/dynamicImport/index.js.map +0 -1
  97. package/dist/lib/tools/formatting/index.js.map +0 -1
  98. package/dist/lib/tools/proxy/index.js.map +0 -1
  99. package/dist/lib/tools/three/index.js.map +0 -1
  100. package/dist/lib/types/McEdGetPointWorldDrawObject.js.map +0 -1
  101. package/dist/lib/types/MrxDbgUiPrPoint.js.map +0 -1
  102. package/dist/lib/types/MxCADObject.js.map +0 -1
  103. package/dist/lib/types/MxDrawObject.js.map +0 -1
  104. package/dist/lib/types/MxFun.js.map +0 -1
@@ -4,39 +4,23 @@ var three_1 = require("three");
4
4
  // import { SVGLoader } from 'three/examples/jsm/loaders/SVGLoader'
5
5
  var SVGLoader_1 = require("./SVGLoader");
6
6
  var three_2 = require("../../tools/three");
7
- function default_1(MxThreeJS) {
8
- MxThreeJS.createImage = function (pos, w, h, imageUrlPath, callResult) {
9
- new three_1.TextureLoader().load(imageUrlPath, function (texture) {
10
- var geometry = new three_1.PlaneGeometry(w, h);
11
- // 测试 transparent: true,打开,renderOrder才管用。
12
- var materialTexture = new three_1.MeshLambertMaterial({
13
- map: texture,
14
- transparent: true,
15
- side: three_1.DoubleSide
16
- });
17
- if (materialTexture.map)
18
- materialTexture.map.needsUpdate = true;
19
- (0, three_2.setGeometryPostion)(geometry, pos);
20
- //var mesh = new Mesh(geometry, material);
21
- var mesh = new three_1.Mesh(geometry, materialTexture);
22
- mesh.material['depthTest'] = false;
23
- //mesh.renderOrder = renderOrder;
24
- callResult && callResult(mesh);
25
- }, undefined, function (err) {
26
- console.log(err);
27
- callResult && callResult(null);
28
- });
29
- };
30
- MxThreeJS.loadSVG = function (url, x, y, scale, color, callResult) {
7
+ var MxThreeJSSVGData = /** @class */ (function () {
8
+ function MxThreeJSSVGData() {
9
+ this.svg = new three_1.Group();
10
+ this.aryMeterial = [];
11
+ }
12
+ return MxThreeJSSVGData;
13
+ }());
14
+ var MxThreeJSBuffer = /** @class */ (function () {
15
+ function MxThreeJSBuffer() {
16
+ this.mapSvgUrlToData = new Map();
17
+ }
18
+ MxThreeJSBuffer.prototype.loadSVGImp = function (url, color, callResult) {
31
19
  var loader = new SVGLoader_1.SVGLoader();
32
20
  loader.load(url, function (data) {
33
21
  var aryMeterial = [];
34
22
  var paths = data.paths;
35
23
  var group = new three_1.Group();
36
- group.scale.multiplyScalar(scale);
37
- group.position.x = x;
38
- group.position.y = y;
39
- group.scale.y *= -1;
40
24
  var drawStrokes = true;
41
25
  var strokesWireframe = false;
42
26
  var drawFillShapes = true;
@@ -85,8 +69,66 @@ function default_1(MxThreeJS) {
85
69
  }
86
70
  }
87
71
  callResult && callResult(group, aryMeterial);
72
+ }, undefined, function () {
73
+ callResult && callResult(null, null);
74
+ });
75
+ };
76
+ MxThreeJSBuffer.prototype.loadSVG = function (url, color, callResult) {
77
+ var _this = this;
78
+ var data = this.mapSvgUrlToData.get(url);
79
+ if (data) {
80
+ if (callResult) {
81
+ if (data == null)
82
+ callResult(null, null);
83
+ else
84
+ callResult(data.svg.clone(), data.aryMeterial);
85
+ }
86
+ return;
87
+ }
88
+ else {
89
+ this.loadSVGImp(url, color, function (group, aryMeterial) {
90
+ if (group && aryMeterial) {
91
+ var data_1 = new MxThreeJSSVGData;
92
+ data_1.svg = group;
93
+ data_1.aryMeterial = aryMeterial;
94
+ _this.mapSvgUrlToData.set(url, data_1);
95
+ callResult && callResult(data_1.svg.clone(), data_1.aryMeterial);
96
+ }
97
+ else {
98
+ _this.mapSvgUrlToData.set(url, null);
99
+ callResult && callResult(null, null);
100
+ }
101
+ });
102
+ }
103
+ };
104
+ return MxThreeJSBuffer;
105
+ }());
106
+ function default_1(MxThreeJS) {
107
+ var mxThreeJsBuffer = new MxThreeJSBuffer;
108
+ MxThreeJS.createImage = function (pos, w, h, imageUrlPath, callResult) {
109
+ new three_1.TextureLoader().load(imageUrlPath, function (texture) {
110
+ var geometry = new three_1.PlaneGeometry(w, h);
111
+ // 测试 transparent: true,打开,renderOrder才管用。
112
+ var materialTexture = new three_1.MeshLambertMaterial({
113
+ map: texture,
114
+ transparent: true,
115
+ side: three_1.DoubleSide
116
+ });
117
+ if (materialTexture.map)
118
+ materialTexture.map.needsUpdate = true;
119
+ (0, three_2.setGeometryPostion)(geometry, pos);
120
+ //var mesh = new Mesh(geometry, material);
121
+ var mesh = new three_1.Mesh(geometry, materialTexture);
122
+ mesh.material['depthTest'] = false;
123
+ //mesh.renderOrder = renderOrder;
124
+ callResult && callResult(mesh);
125
+ }, undefined, function (err) {
126
+ console.log(err);
127
+ callResult && callResult(null);
88
128
  });
89
129
  };
130
+ MxThreeJS.loadSVG = function (url, color, callResult) {
131
+ mxThreeJsBuffer.loadSVG(url, color, callResult);
132
+ };
90
133
  }
91
134
  exports.default = default_1;
92
- //# sourceMappingURL=MxThreeJS.mixin.js.map
@@ -1185,13 +1185,13 @@ var SVGLoader = /** @class */ (function (_super) {
1185
1185
  var center = new three_1.Vector2();
1186
1186
  boundingBox.getCenter(center);
1187
1187
  var allIntersections = [];
1188
- paths.forEach(function (path) {
1188
+ paths && paths.forEach(function (path) {
1189
1189
  // check if the center of the bounding box is in the bounding box of the paths.
1190
1190
  // this is a pruning method to limit the search of intersections in paths that can't envelop of the current path.
1191
1191
  // if a path envelops another path. The center of that oter path, has to be inside the bounding box of the enveloping path.
1192
1192
  if (path.boundingBox.containsPoint(center)) {
1193
1193
  var intersections = getIntersections(scanline, path.points);
1194
- intersections.forEach(function (p) {
1194
+ intersections && intersections.forEach(function (p) {
1195
1195
  allIntersections.push({ identifier: path.identifier, isCW: path.isCW, point: p });
1196
1196
  });
1197
1197
  }
@@ -1307,13 +1307,13 @@ var SVGLoader = /** @class */ (function (_super) {
1307
1307
  // check if path is solid or a hole
1308
1308
  var isAHole = simplePaths.map(function (p) { return isHoleTo(p, simplePaths, scanlineMinX, scanlineMaxX, shapePath.userData.style.fillRule); });
1309
1309
  var shapesToReturn = [];
1310
- simplePaths.forEach(function (p) {
1310
+ simplePaths && simplePaths.forEach(function (p) {
1311
1311
  var amIAHole = isAHole[p.identifier];
1312
1312
  if (!amIAHole.isHole) {
1313
1313
  var shape_1 = new three_1.Shape();
1314
1314
  shape_1.curves = p.curves;
1315
1315
  var holes = isAHole.filter(function (h) { return h.isHole && h.for === p.identifier; });
1316
- holes.forEach(function (h) {
1316
+ holes && holes.forEach(function (h) {
1317
1317
  var hole = simplePaths[h.identifier];
1318
1318
  var path = new three_1.Path();
1319
1319
  path.curves = hole.curves;
@@ -1860,4 +1860,3 @@ var SVGLoader = /** @class */ (function (_super) {
1860
1860
  return SVGLoader;
1861
1861
  }(three_1.Loader));
1862
1862
  exports.SVGLoader = SVGLoader;
1863
- //# sourceMappingURL=SVGLoader.js.map
@@ -5,4 +5,3 @@ var MxThreeJS_1 = require("./MxThreeJS");
5
5
  var MxThreeJS = new MxThreeJS_1.default();
6
6
  (0, MxThreeJS_mixin_1.default)(MxThreeJS);
7
7
  exports.default = MxThreeJS;
8
- //# sourceMappingURL=index.js.map
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ /** @module MxType*/
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ /**
5
+ * 动态绘制类型
6
+ * @example ```typescript
7
+
8
+ * ```
9
+ */
10
+ var MxCloneType;
11
+ (function (MxCloneType) {
12
+ /** 正常Clone */
13
+ MxCloneType[MxCloneType["kClone"] = 1] = "kClone";
14
+ /** 动态拖动Clone */
15
+ MxCloneType[MxCloneType["kDragClone"] = 2] = "kDragClone";
16
+ })(MxCloneType || (MxCloneType = {}));
17
+ var MxCloneType2;
18
+ (function (MxCloneType2) {
19
+ /** 正常Clone */
20
+ MxCloneType2[MxCloneType2["kClone"] = 1] = "kClone";
21
+ /** 动态拖动Clone */
22
+ MxCloneType2[MxCloneType2["kDragClone"] = 2] = "kDragClone";
23
+ })(MxCloneType2 || (MxCloneType2 = {}));
24
+ exports.default = {
25
+ MxCloneType: MxCloneType,
26
+ MxCloneType2: MxCloneType2
27
+ };
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var MxType_1 = require("./MxType");
4
+ exports.default = MxType_1.default;
@@ -3,4 +3,3 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  /** @module loadCoreCode */
4
4
  var loadCoreCode_1 = require("./loadCoreCode");
5
5
  exports.default = loadCoreCode_1.default;
6
- //# sourceMappingURL=index.js.map
@@ -106,4 +106,3 @@ function loadCoreCode() {
106
106
  });
107
107
  }
108
108
  exports.default = loadCoreCode;
109
- //# sourceMappingURL=loadCoreCode.js.map