mxdraw 0.1.11 → 0.1.12
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.
- package/dist/lib/MxModule/MxDbSVG/MxDbSVG.js +41 -16
- package/dist/lib/MxModule/MxThreeJS/MxThreeJS.mixin.js +2 -2
- package/dist/lib/MxModule/loadCoreCode/mxfun.es5.js +1 -1
- package/dist/mxdraw.es5.js +2 -2
- package/dist/mxdraw.es5.js.map +1 -1
- package/dist/mxdraw.umd.js +2 -2
- package/dist/mxdraw.umd.js.map +1 -1
- package/dist/types/MxModule/MxDbSVG/MxDbSVG.d.ts +3 -0
- package/package.json +1 -1
|
@@ -39,6 +39,8 @@ var MxDbSVG = /** @class */ (function (_super) {
|
|
|
39
39
|
_this.svgSize = new THREE.Vector2(50, 50);
|
|
40
40
|
_this.svgAlignmentRatio = new THREE.Vector2(0, 0);
|
|
41
41
|
_this.svgRotate = 0;
|
|
42
|
+
_this.svgReverse = false;
|
|
43
|
+
_this.svgMargin = new THREE.Vector2(0, 0);
|
|
42
44
|
_this.isSvgDirtyLocation = false;
|
|
43
45
|
_this.isLoadFromPath = true;
|
|
44
46
|
_this.aryText = [];
|
|
@@ -48,21 +50,37 @@ var MxDbSVG = /** @class */ (function (_super) {
|
|
|
48
50
|
_this.useSvgColor = false;
|
|
49
51
|
return _this;
|
|
50
52
|
}
|
|
51
|
-
MxDbSVG.prototype.
|
|
52
|
-
var _this = this;
|
|
53
|
-
var mxObj = pWorldDraw.getMxObject();
|
|
54
|
-
this.calcSvgPosition(mxObj);
|
|
53
|
+
MxDbSVG.prototype.calcVewSize = function (mxObj) {
|
|
55
54
|
var sizew = this.svgSize.x;
|
|
56
55
|
var sizeh = this.svgSize.y;
|
|
56
|
+
if (sizeh <= 0) {
|
|
57
|
+
if (this.svgBoxSize) {
|
|
58
|
+
sizeh = (this.svgBoxSize.y / this.svgBoxSize.x) * sizew;
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
sizeh = sizew;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
57
64
|
if (this.fixedSize) {
|
|
58
65
|
sizew = mxObj.screenCoordLong2Doc(sizew);
|
|
59
66
|
sizeh = mxObj.screenCoordLong2Doc(sizeh);
|
|
60
67
|
}
|
|
68
|
+
return [sizew, sizeh];
|
|
69
|
+
};
|
|
70
|
+
MxDbSVG.prototype.worldDraw = function (pWorldDraw) {
|
|
71
|
+
var _this = this;
|
|
72
|
+
var mxObj = pWorldDraw.getMxObject();
|
|
73
|
+
this.calcSvgPosition(mxObj);
|
|
74
|
+
var _a = this.calcVewSize(mxObj), sizew = _a[0], sizeh = _a[1];
|
|
75
|
+
var matSclae = new THREE.Matrix4();
|
|
76
|
+
if (this.svgReverse)
|
|
77
|
+
matSclae.makeScale(1, -1, 1);
|
|
61
78
|
var mat = new THREE.Matrix4();
|
|
62
79
|
mat.makeRotationZ(this.svgRotate);
|
|
63
80
|
var matMove = new THREE.Matrix4();
|
|
64
81
|
var svgNewPos = new THREE.Vector3(this.svgPos.x - sizew * this.svgAlignmentRatio.x, this.svgPos.y - sizeh * this.svgAlignmentRatio.y, 0);
|
|
65
82
|
matMove.makeTranslation(svgNewPos.x, svgNewPos.y, svgNewPos.z);
|
|
83
|
+
mat.multiply(matSclae);
|
|
66
84
|
mat.premultiply(matMove);
|
|
67
85
|
var pt1 = new THREE.Vector3(0, 0, 0);
|
|
68
86
|
var pt3 = new THREE.Vector3(sizew, 0, 0);
|
|
@@ -116,9 +134,13 @@ var MxDbSVG = /** @class */ (function (_super) {
|
|
|
116
134
|
}
|
|
117
135
|
myThis_1.svgBoxSize.x = box.max.x - box.min.x;
|
|
118
136
|
myThis_1.svgBoxSize.y = box.max.y - box.min.y;
|
|
119
|
-
|
|
120
|
-
obj.scale.
|
|
137
|
+
var _a = myThis_1.calcVewSize(mxObj), sizew_1 = _a[0], sizeh_1 = _a[1];
|
|
138
|
+
obj.scale.x = sizew_1 / myThis_1.svgBoxSize.x;
|
|
139
|
+
obj.scale.y = sizeh_1 / myThis_1.svgBoxSize.y;
|
|
121
140
|
obj.scale.z = obj.scale.x;
|
|
141
|
+
if (myThis_1.svgReverse) {
|
|
142
|
+
obj.scale.y *= -1;
|
|
143
|
+
}
|
|
122
144
|
obj.rotateZ(myThis_1.svgRotate);
|
|
123
145
|
myThis_1.isSvgDirtyLocation = true;
|
|
124
146
|
var color_1 = new THREE.Color(pWorldDraw.getColor());
|
|
@@ -212,14 +234,11 @@ var MxDbSVG = /** @class */ (function (_super) {
|
|
|
212
234
|
return;
|
|
213
235
|
}
|
|
214
236
|
this.isSvgDirtyLocation = false;
|
|
215
|
-
var
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
sizeh
|
|
220
|
-
}
|
|
221
|
-
this.svg.position.x = this.svgPos.x - sizew * this.svgAlignmentRatio.x;
|
|
222
|
-
this.svg.position.y = this.svgPos.y - sizeh * this.svgAlignmentRatio.y;
|
|
237
|
+
var _a = this.calcVewSize(mxObj), sizew = _a[0], sizeh = _a[1];
|
|
238
|
+
this.svg.position.x =
|
|
239
|
+
this.svgPos.x - sizew * this.svgAlignmentRatio.x - this.svgMargin.x * sizew;
|
|
240
|
+
this.svg.position.y =
|
|
241
|
+
this.svgPos.y - sizeh * this.svgAlignmentRatio.y - this.svgMargin.y * sizeh;
|
|
223
242
|
};
|
|
224
243
|
MxDbSVG.prototype.dwgIn = function (obj) {
|
|
225
244
|
var _this = this;
|
|
@@ -251,6 +270,8 @@ var MxDbSVG = /** @class */ (function (_super) {
|
|
|
251
270
|
});
|
|
252
271
|
this.svgRotate = obj['svgRotate'];
|
|
253
272
|
this.useSvgColor = obj['useSvgColor'];
|
|
273
|
+
this.svgReverse = obj['svgReverse'];
|
|
274
|
+
this.svgMargin = obj['svgMargin'];
|
|
254
275
|
return true;
|
|
255
276
|
};
|
|
256
277
|
MxDbSVG.prototype.dwgOut = function (obj) {
|
|
@@ -266,6 +287,8 @@ var MxDbSVG = /** @class */ (function (_super) {
|
|
|
266
287
|
obj['fixedSize'] = this.fixedSize;
|
|
267
288
|
obj['svgRotate'] = this.svgRotate;
|
|
268
289
|
obj['useSvgColor'] = this.useSvgColor;
|
|
290
|
+
obj['svgReverse'] = this.svgReverse;
|
|
291
|
+
obj['svgMargin'] = this.svgMargin;
|
|
269
292
|
return obj;
|
|
270
293
|
};
|
|
271
294
|
MxDbSVG.prototype.create = function () {
|
|
@@ -308,11 +331,13 @@ var MxDbSVG = /** @class */ (function (_super) {
|
|
|
308
331
|
this.svgBoxSize.x = box.max.x - box.min.x;
|
|
309
332
|
this.svgBoxSize.y = box.max.y - box.min.y;
|
|
310
333
|
}
|
|
311
|
-
var
|
|
312
|
-
var sizeh = mxObj.screenCoordLong2Doc(this.svgSize.y);
|
|
334
|
+
var _a = this.calcVewSize(mxObj), sizew = _a[0], sizeh = _a[1];
|
|
313
335
|
this.svg.scale.x = sizew / this.svgBoxSize.x;
|
|
314
336
|
this.svg.scale.y = sizeh / this.svgBoxSize.y;
|
|
315
337
|
this.svg.scale.z = this.svg.scale.x;
|
|
338
|
+
if (this.svgReverse) {
|
|
339
|
+
this.svg.scale.y *= -1;
|
|
340
|
+
}
|
|
316
341
|
this.isSvgDirtyLocation = true;
|
|
317
342
|
this.calcSvgPosition(mxObj);
|
|
318
343
|
}
|
|
@@ -21,10 +21,10 @@ var MxThreeJSBuffer = /** @class */ (function () {
|
|
|
21
21
|
var aryMeterial = [];
|
|
22
22
|
var paths = data.paths;
|
|
23
23
|
var group = new three_1.Group();
|
|
24
|
-
var drawStrokes =
|
|
25
|
-
var strokesWireframe = false;
|
|
24
|
+
var drawStrokes = false;
|
|
26
25
|
var drawFillShapes = true;
|
|
27
26
|
var fillShapesWireframe = false;
|
|
27
|
+
var strokesWireframe = false;
|
|
28
28
|
for (var i = 0; i < paths.length; i++) {
|
|
29
29
|
var path = paths[i];
|
|
30
30
|
var fillColor = path.userData.style.fill;
|
|
@@ -7254,7 +7254,7 @@ function mxfun() { !function a(o, s, l) { function c(e, t) { if (!s[e]) {
|
|
|
7254
7254
|
return !1; d.OnMxEvent(t); };
|
|
7255
7255
|
}, { "./MxCmdRunManager": 33, "./MxFun": 45, "./MxJigCmdManager": 48, "./MxTools": 59 }], 65: [function (t, e, n) {
|
|
7256
7256
|
"use strict";
|
|
7257
|
-
Object.defineProperty(n, "__esModule", { value: !0 }), n.MxBulid = void 0, window.MxDrawVersion = "1.0(2022-04-
|
|
7257
|
+
Object.defineProperty(n, "__esModule", { value: !0 }), n.MxBulid = void 0, window.MxDrawVersion = "1.0(2022-04-26 11:53)", (n.MxBulid || (n.MxBulid = {})).getVersion = function () { return window.MxDrawVersion ? window.MxDrawVersion : "inalid version"; };
|
|
7258
7258
|
}, {}], 66: [function (t, e, n) {
|
|
7259
7259
|
"use strict";
|
|
7260
7260
|
Object.defineProperty(n, "__esModule", { value: !0 }), n.MxWindowsEvent = void 0;
|