mxdraw 0.1.8 → 0.1.9
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/MxDbEntity/MxDbEntity.js +25 -12
- package/dist/lib/MxModule/MxDbRect/MxDbRect.js +140 -86
- package/dist/lib/MxModule/MxDbSVG/MxDbSVG.js +49 -32
- package/dist/lib/MxModule/MxDbSVGText/MxDbSVGText.js +18 -0
- package/dist/lib/MxModule/MxDbSVGText/index.js +5 -0
- package/dist/lib/MxModule/MxFun/MxFun.js +13 -0
- package/dist/lib/MxModule/loadCoreCode/loadCoreCode.js +2 -0
- package/dist/lib/MxModule/loadCoreCode/mxfun.es5.js +36 -23
- package/dist/lib/mxdraw.js +4 -1
- package/dist/lib/tools/three/index.js +21 -15
- package/dist/mxdraw.es5.js +3 -3
- package/dist/mxdraw.es5.js.map +1 -1
- package/dist/mxdraw.umd.js +3 -3
- package/dist/mxdraw.umd.js.map +1 -1
- package/dist/types/MxModule/MxDbEntity/MxDbEntity.d.ts +12 -4
- package/dist/types/MxModule/MxDbRect/MxDbRect.d.ts +21 -42
- package/dist/types/MxModule/MxDbSVG/MxDbSVG.d.ts +5 -9
- package/dist/types/MxModule/MxDbSVGText/MxDbSVGText.d.ts +7 -0
- package/dist/types/MxModule/MxDbSVGText/index.d.ts +3 -0
- package/dist/types/MxModule/MxFun/MxFun.d.ts +12 -0
- package/dist/types/mxdraw.d.ts +3 -1
- package/package.json +1 -1
|
@@ -5318,7 +5318,7 @@ function mxfun() { !function a(o, s, l) { function c(e, t) { if (!s[e]) {
|
|
|
5318
5318
|
this.drawEntity(i), this.drawEntity(u.MxThreeJS.createLines(t.slice(0), this.iColor, 0));
|
|
5319
5319
|
}
|
|
5320
5320
|
else
|
|
5321
|
-
this.drawEntity(u.MxThreeJS.createLines(t.slice(0), this.iColor)); }, d.prototype.drawSelectLine = function (t, e, n, i) { t instanceof Object && e instanceof Object ? this.drawEntity(u.MxThreeJS.createLine(t, e, this.iColor, 0)) : "number" == typeof t && "number" == typeof e && this.drawEntity(u.MxThreeJS.createLine(new c.Vector3(t, e, 0), new c.Vector3(n, i, 0), this.iColor, 0)); }, d.prototype.drawLine = function (t, e, n, i) { var r, a; if (t instanceof Object && e instanceof Object ? (r = t, a = e) : "number" == typeof t && "number" == typeof e && (r = new c.Vector3(t, e, 0), a = new c.Vector3(n, i, 0)), 0 != this.dLineWidth) {
|
|
5321
|
+
this.drawEntity(u.MxThreeJS.createLines(t.slice(0), this.iColor, this.opacity)); }, d.prototype.drawSelectLine = function (t, e, n, i) { t instanceof Object && e instanceof Object ? this.drawEntity(u.MxThreeJS.createLine(t, e, this.iColor, 0)) : "number" == typeof t && "number" == typeof e && this.drawEntity(u.MxThreeJS.createLine(new c.Vector3(t, e, 0), new c.Vector3(n, i, 0), this.iColor, 0)); }, d.prototype.drawLine = function (t, e, n, i) { var r, a; if (t instanceof Object && e instanceof Object ? (r = t, a = e) : "number" == typeof t && "number" == typeof e && (r = new c.Vector3(t, e, 0), a = new c.Vector3(n, i, 0)), 0 != this.dLineWidth) {
|
|
5322
5322
|
this.createWidthMaterial();
|
|
5323
5323
|
var o = new Float32Array(6);
|
|
5324
5324
|
o[0] = r.x, o[1] = r.y, o[2] = 0, o[3] = a.x, o[4] = a.y, o[5] = 0;
|
|
@@ -5328,10 +5328,12 @@ function mxfun() { !function a(o, s, l) { function c(e, t) { if (!s[e]) {
|
|
|
5328
5328
|
l.renderOrder = this.iRenderOrder, this.drawEntity(l), this.drawSelectLine(r, a);
|
|
5329
5329
|
}
|
|
5330
5330
|
else
|
|
5331
|
-
this.drawEntity(u.MxThreeJS.createLine(r, a, this.iColor)); }, d.prototype.drawCircle = function (t, e) { this.drawEntity(u.MxThreeJS.createCircle(t, e, this.iColor)); }, d.prototype.drawText = function (t, e, n, i) { var r = u.MxThreeJS.creatTextSprite(t, i, e, n, this.iColor); this.drawEntity(r); }, d.prototype.setupForEntity = function (t) { this.iColor = t.getColor(), this.iRenderOrder = t.getRenderOrder(); }, d);
|
|
5332
|
-
function d(t, e) { this.aryEntity = [], this.iColor = 16777215, this.dLineWidth = 0, this.lineWidthIsPixels = !0, this.iRenderOrder = s.MxData.iMxEntityRenderOrder, this.worldDrawType = 1, this.widthMaterial = null, this.dDashArray = 0, this.dDashRatio = 0, this.mxObj = t, this.worldDrawType = e; }
|
|
5331
|
+
this.drawEntity(u.MxThreeJS.createLine(r, a, this.iColor, this.opacity)); }, d.prototype.drawCircle = function (t, e) { this.drawEntity(u.MxThreeJS.createCircle(t, e, this.iColor)); }, d.prototype.drawText = function (t, e, n, i) { var r = u.MxThreeJS.creatTextSprite(t, i, e, n, this.iColor); this.drawEntity(r); }, d.prototype.setupForEntity = function (t) { this.iColor = t.getColor(), this.iRenderOrder = t.getRenderOrder(), this.opacity = t.opacity; }, d);
|
|
5332
|
+
function d(t, e) { this.aryEntity = [], this.iColor = 16777215, this.dLineWidth = 0, this.lineWidthIsPixels = !0, this.iRenderOrder = s.MxData.iMxEntityRenderOrder, this.worldDrawType = 1, this.widthMaterial = null, this.dDashArray = 0, this.dDashRatio = 0, this.opacity = 1, this.mxObj = t, this.worldDrawType = e; }
|
|
5333
5333
|
n.McGiWorldDraw = l;
|
|
5334
|
-
var p, f = (r(m, p = l), m.prototype.setCurEntityId = function (t) { this.curEntityId = t; }, m.prototype.drawEntity = function (t) { }, m.prototype.drawText = function (t, e, n, i) { }, m.prototype.drawSelectLine = function (t, e, n, i) { }, m.prototype.isValid = function () { return 0 != this.curEntityId || (console.log("this.curEntityId == 0"), !1); }, m.prototype.drawLine = function (t, e, n, i) { var r, a; this.isValid() && (t instanceof Object && e instanceof Object ? (r = t, a = e) : "number" == typeof t && "number" == typeof e && (r = new c.Vector3(t, e, 0), a = new c.Vector3(n, i, 0)), this.selectManager.addLineDisplay(this.curEntityId, r, a)); }, m.prototype.drawCircle = function (t, e) { this.isValid() && this.selectManager.addCircleDisplay(this.curEntityId, t, e); }, m)
|
|
5334
|
+
var p, f = (r(m, p = l), m.prototype.setCurEntityId = function (t) { this.curEntityId = t; }, m.prototype.drawEntity = function (t) { }, m.prototype.drawText = function (t, e, n, i) { }, m.prototype.drawSelectLine = function (t, e, n, i) { }, m.prototype.isValid = function () { return 0 != this.curEntityId || (console.log("this.curEntityId == 0"), !1); }, m.prototype.drawLine = function (t, e, n, i) { var r, a; this.isValid() && (t instanceof Object && e instanceof Object ? (r = t, a = e) : "number" == typeof t && "number" == typeof e && (r = new c.Vector3(t, e, 0), a = new c.Vector3(n, i, 0)), this.selectManager.addLineDisplay(this.curEntityId, r, a)); }, m.prototype.drawCircle = function (t, e) { this.isValid() && this.selectManager.addCircleDisplay(this.curEntityId, t, e); }, m.prototype.drawLines = function (t) { if (!(t.length < 2))
|
|
5335
|
+
for (var e = t.length, n = 0; n < e - 1; n++)
|
|
5336
|
+
this.selectManager.addLineDisplay(this.curEntityId, t[n], t[n + 1]); }, m);
|
|
5335
5337
|
function m(t, e) { var n = p.call(this, t, a.kSelectDraw) || this; return n.selectManager = e, n.curEntityId = 0, n; }
|
|
5336
5338
|
n.McGiWorldDrawSelect = f;
|
|
5337
5339
|
}, { "./MxManager": 51, "./MxThreeJS": 58, three: 19, "three.meshline": 18 }], 22: [function (t, e, n) {
|
|
@@ -5987,21 +5989,31 @@ function mxfun() { !function a(o, s, l) { function c(e, t) { if (!s[e]) {
|
|
|
5987
5989
|
}, { "./MxDbEntity": 35, "./MxDbEntityGrip": 36, "./MxDbEntitySelect": 37, "./MxFun": 45, "./MxManager": 51, "./MxType": 60, three: 19 }], 35: [function (t, e, n) {
|
|
5988
5990
|
"use strict";
|
|
5989
5991
|
Object.defineProperty(n, "__esModule", { value: !0 }), n.MxDbEntity = n.MxDbEntityClassHierarchy = n.MxDbEntityUserObject = void 0;
|
|
5990
|
-
var s = t("three"), l = t("./McGiWorldDraw"), i = t("./MxManager"), r = t("./MxType"), a = (o.prototype.getTypeName = function () { return ""; }, o.prototype.getImp = function () { return this.MxDbEntityImp; }, o.prototype.upDisplay = function () { var t = this.getImp(); return !!t && t.upDisplay(); }, o.prototype.erase = function () { var t = this.getImp(); return !!t && t.erase(); }, o.prototype.setColor = function (t) { this.iColor = t; }, o.prototype.getColor = function () { return this.iColor; }, o.prototype.setRenderOrder = function (t) { this.iRenderOrder = t; }, o.prototype.getRenderOrder = function () { return this.iRenderOrder; }, o.prototype.dwgIn = function (t) { return this.iColor = t.iColor, this.iRenderOrder = t.iRenderOrder, !0; }, o.prototype.dwgOut = function (t) { return t.iColor = this.iColor, t.iRenderOrder = this.iRenderOrder, t; }, o.prototype.clone = function (t) { var e = this.create(), n = { type: t || r.MxType.MxCloneType.kClone }; return this.dwgOut(n), e.dwgIn(n), e; }, o.prototype.init = function () { i.MxManager.getMxDbEntityClassHierarchy().init(this); }, o.prototype.transformBy = function (t) { }, o.prototype.objectId = function () { var t = this.getImp(); return t ? t.objectId() : 0; }, o);
|
|
5991
|
-
function o() { this.iColor = 16777215, this.iRenderOrder = i.MxData.iMxEntityRenderOrder; }
|
|
5992
|
+
var s = t("three"), l = t("./McGiWorldDraw"), i = t("./MxManager"), c = t("./MxTools"), r = t("./MxType"), a = (o.prototype.getTypeName = function () { return ""; }, o.prototype.getImp = function () { return this.MxDbEntityImp; }, o.prototype.upDisplay = function () { var t = this.getImp(); return !!t && t.upDisplay(); }, o.prototype.erase = function () { var t = this.getImp(); return !!t && t.erase(); }, o.prototype.setColor = function (t) { this.iColor = t; }, o.prototype.getColor = function () { return this.iColor; }, o.prototype.setRenderOrder = function (t) { this.iRenderOrder = t; }, o.prototype.getRenderOrder = function () { return this.iRenderOrder; }, o.prototype.dwgIn = function (t) { return this.iColor = t.iColor, this.iRenderOrder = t.iRenderOrder, this.opacity = t.opacity, this.visible = t.visible, !0; }, o.prototype.dwgOut = function (t) { return t.iColor = this.iColor, t.iRenderOrder = this.iRenderOrder, t.opacity = this.opacity, t.visible = this.visible, t; }, o.prototype.clone = function (t) { var e = this.create(), n = { type: t || r.MxType.MxCloneType.kClone }; return this.dwgOut(n), e.dwgIn(n), e; }, o.prototype.init = function () { i.MxManager.getMxDbEntityClassHierarchy().init(this); }, o.prototype.transformBy = function (t) { }, o.prototype.objectId = function () { var t = this.getImp(); return t ? t.objectId() : 0; }, o);
|
|
5993
|
+
function o() { this.iColor = 16777215, this.iRenderOrder = i.MxData.iMxEntityRenderOrder, this.opacity = 1, this.visible = !0; }
|
|
5992
5994
|
n.MxDbEntityUserObject = a;
|
|
5993
|
-
var
|
|
5994
|
-
function
|
|
5995
|
-
n.MxDbEntityClassHierarchy =
|
|
5996
|
-
var
|
|
5997
|
-
return !1; this.updateDisplayImp(this.mxDatabase.getThreeJSParentObject(), this.mxDatabase.getMxObject()); },
|
|
5998
|
-
return !1; this.clearDisplayImp(this.mxDatabase.getThreeJSParentObject()), this.userObject = null, this.mxDatabase.eraseEntity(this.id), this.id = 0, this.mxDatabase = null; },
|
|
5999
|
-
|
|
6000
|
-
|
|
6001
|
-
|
|
6002
|
-
|
|
6003
|
-
|
|
6004
|
-
|
|
5995
|
+
var u = (h.prototype.init = function (t) { var e = t.getTypeName(); this.mapType2Create.get(e) && console.log("MxError:already has this class name " + e), this.mapType2Create.set(e, t); }, h.prototype.createMxEntity = function (t) { var e = this.mapType2Create.get(t); return e ? e.create() : null; }, h);
|
|
5996
|
+
function h() { this.mapType2Create = new Map; }
|
|
5997
|
+
n.MxDbEntityClassHierarchy = u;
|
|
5998
|
+
var d = (p.prototype.setObjectId = function (t) { this.id = t; }, p.prototype.setDirtyDisplay = function (t) { this.isDirtyDisplay = t; }, p.prototype.getDirtyDisplay = function () { return this.isDirtyDisplay; }, p.prototype.setMxDatabase = function (t) { this.mxDatabase = t; }, p.prototype.objectId = function () { return this.id; }, p.prototype.initUserObject = function (t) { (this.userObject = t).MxDbEntityImp = this; }, p.prototype.upDisplay = function () { if (!this.mxDatabase)
|
|
5999
|
+
return !1; this.updateDisplayImp(this.mxDatabase.getThreeJSParentObject(), this.mxDatabase.getMxObject()); }, p.prototype.erase = function () { if (0 == this.id)
|
|
6000
|
+
return !1; this.clearDisplayImp(this.mxDatabase.getThreeJSParentObject()), this.userObject = null, this.mxDatabase.eraseEntity(this.id), this.id = 0, this.mxDatabase = null; }, p.prototype.clearDisplayImp = function (t) { this.threeObjectGroup && (this.threeObjectGroup.traverse(function (t) { "Mesh" === t.type && (t.geometry.dispose(), t.material.dispose()); }), t.remove(this.threeObjectGroup)), this.threeObjectGroup = null; }, p.prototype.updateDisplayImp = function (t, e) { if (this.clearDisplayImp(t), this.userObject) {
|
|
6001
|
+
if (this.userObject.visible) {
|
|
6002
|
+
this.threeObjectGroup = new s.Group;
|
|
6003
|
+
var n = new l.McGiWorldDraw(e, l.McGiWorldDrawType.kWorldDraw);
|
|
6004
|
+
n.setupForEntity(this.userObject), this.worldDraw(n);
|
|
6005
|
+
for (var i = n.getEntitys(), r = i.length, a = 0; a < r; a++) {
|
|
6006
|
+
var o = i[a];
|
|
6007
|
+
(o.MxDbEntity = this).threeObjectGroup.add(o);
|
|
6008
|
+
}
|
|
6009
|
+
t.add(this.threeObjectGroup);
|
|
6010
|
+
}
|
|
6011
|
+
}
|
|
6012
|
+
else
|
|
6013
|
+
c.MxTools.MxASSERT(!1, "this.userObject == null"); }, p.prototype.worldDraw = function (t) { this.userObject.worldDraw(t); }, p.prototype.getGripPoints = function () { return this.userObject.getGripPoints(); }, p.prototype.getUserObject = function () { return this.userObject; }, p.prototype.clone = function (t) { var e = new p; return e.initUserObject(this.userObject.clone(t)), e; }, p.prototype.transformBy = function (t) { this.userObject.transformBy(t); }, p.prototype.setColor = function (t) { this.userObject.setColor(t); }, p.prototype.getColor = function () { return this.userObject.getColor(); }, p);
|
|
6014
|
+
function p() { this.threeObjectGroup = null, this.userObject = null, this.mxDatabase = null, this.isDirtyDisplay = !1, this.id = 0; }
|
|
6015
|
+
n.MxDbEntity = d;
|
|
6016
|
+
}, { "./McGiWorldDraw": 21, "./MxManager": 51, "./MxTools": 59, "./MxType": 60, three: 19 }], 36: [function (t, e, n) {
|
|
6005
6017
|
"use strict";
|
|
6006
6018
|
var i, r = this && this.__extends || (i = function (t, e) { return (i = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (t, e) { t.__proto__ = e; } || function (t, e) { for (var n in e)
|
|
6007
6019
|
Object.prototype.hasOwnProperty.call(e, n) && (t[n] = e[n]); })(t, e); }, function (t, e) { if ("function" != typeof e && null !== e)
|
|
@@ -6130,7 +6142,8 @@ function mxfun() { !function a(o, s, l) { function c(e, t) { if (!s[e]) {
|
|
|
6130
6142
|
Object.defineProperty(n, "__esModule", { value: !0 }), n.MxDrawObject = n.IniSetName = n.MxRunMode = void 0;
|
|
6131
6143
|
var s, i, r, c = t("three"), u = t("./MxFun"), a = t("./MxCadSketchLayer"), o = t("./MxBrowseLayerData"), l = t("./MxBrowseDisplay"), O = t("./MxNetData"), h = t("./MxNetData"), d = t("./MxSelect"), p = t("./MxManager"), f = t("./MxJigCmdManager"), m = t("./MxSystemVariable"), g = t("./MxCADObject"), v = t("./MxLocalFileLoad"), y = t("./MxDrawObjectOsnap"), x = t("./MxDbDatabase"), w = t("./MxDbEntity");
|
|
6132
6144
|
(i = s = n.MxRunMode || (n.MxRunMode = {}))[i.kBrowse = 1] = "kBrowse", i[i.kMxCAD = 2] = "kMxCAD", i[i.kMxCADBrowseApp = 3] = "kMxCADBrowseApp", (r = n.IniSetName || (n.IniSetName = {})).kEnableOsnapFunction = "EnableOsnapFunction";
|
|
6133
|
-
var b = (_.prototype.getMxDatabase = function () { return this.m_mxDatabase; }, _.prototype.addMxEntity = function (t) {
|
|
6145
|
+
var b = (_.prototype.getMxDatabase = function () { return this.m_mxDatabase; }, _.prototype.addMxEntity = function (t) { if (t.getImp())
|
|
6146
|
+
return t.objectId(); var e = new w.MxDbEntity; return e.initUserObject(t), this.m_mxDatabase.addEntity(e); }, _.prototype.getMxEntity = function (t) { return this.m_mxDatabase.getEntity(t); }, _.prototype.getMxEntityUserObject = function (t) { var e = this.getMxEntity(t); return e ? e.getUserObject() : null; }, _.prototype.eraseAllMxEntity = function () { this.m_mxDatabase.eraseAllEntity(); }, _.prototype.eraseMxEntity = function (t) { var e = this.m_mxDatabase.getEntity(t); return !!e && e.erase(); }, _.prototype.getAllMxEntity = function () { var e = []; return this.m_mxDatabase.getAllEntity().forEach(function (t) { t && e.push(t.getUserObject()); }), e; }, _.prototype.findMxEntityAtPoint = function (t, e) { !e && void 0 !== e || (t = this.docCoord2Screen(t.x, t.y, 0)); var n = [], i = this.m_mxDatabase.getIntersectObjects(t); if (0 == i.length)
|
|
6134
6147
|
return n; var r = new Map; return i.forEach(function (t) { var e = t.object.MxDbEntity; if (e) {
|
|
6135
6148
|
var n = e.objectId();
|
|
6136
6149
|
r.has(n) || r.set(n, e.getUserObject());
|
|
@@ -6926,7 +6939,7 @@ function mxfun() { !function a(o, s, l) { function c(e, t) { if (!s[e]) {
|
|
|
6926
6939
|
"use strict";
|
|
6927
6940
|
Object.defineProperty(n, "__esModule", { value: !0 }), n.MxThreeJS = void 0;
|
|
6928
6941
|
var i, m = t("three"), g = t("./MxFun");
|
|
6929
|
-
(i = n.MxThreeJS || (n.MxThreeJS = {})).createLine = function (t, e, n, i) { var r, a = new m.Geometry; return r = i || 0 == i ? new m.LineBasicMaterial({ color: n, transparent: !0, depthTest: !1, opacity: i }) : new m.LineBasicMaterial({ color: n, transparent: !0, depthTest: !1 }), a.vertices.push(t, e), new m.Line(a, r); }, i.createCircle = function (t, e, n) { var i = new m.CircleGeometry(e, 64, 3, 2 * Math.PI), r = new m.LineBasicMaterial({ color: n, transparent: !0, depthTest: !1 }); i.vertices.shift(); var a = new m.LineLoop(i, r); return a.position.x = t.x, a.position.y = t.y, a.position.z = t.z, a; }, i.creatTextSprite = function (t, e, n, i, r) { var a, o = document.createElement("canvas"), s = o.getContext("2d"), l = g.MxFun.formatString("normal {0}px Arial", "256"); if (null == s)
|
|
6942
|
+
(i = n.MxThreeJS || (n.MxThreeJS = {})).createLine = function (t, e, n, i) { var r, a = new m.Geometry; return r = i && 1 != i || 0 == i ? new m.LineBasicMaterial({ color: n, transparent: !0, depthTest: !1, opacity: i }) : new m.LineBasicMaterial({ color: n, transparent: !0, depthTest: !1 }), a.vertices.push(t, e), new m.Line(a, r); }, i.createCircle = function (t, e, n) { var i = new m.CircleGeometry(e, 64, 3, 2 * Math.PI), r = new m.LineBasicMaterial({ color: n, transparent: !0, depthTest: !1 }); i.vertices.shift(); var a = new m.LineLoop(i, r); return a.position.x = t.x, a.position.y = t.y, a.position.z = t.z, a; }, i.creatTextSprite = function (t, e, n, i, r) { var a, o = document.createElement("canvas"), s = o.getContext("2d"), l = g.MxFun.formatString("normal {0}px Arial", "256"); if (null == s)
|
|
6930
6943
|
return null; s.font = l; var c, u = s.measureText(t); a = 2 * (c = u.width, Math.pow(2, Math.floor(Math.log(c) / Math.LN2))), o.width = a, o.height = 256, s.font = l, s.textAlign = "center", s.textBaseline = "middle"; var h = g.MxFun.formatString("rgba({0}, {1}, {2}, 1.0)", (r >> 16 & 255) + "", (r >> 8 & 255) + "", (255 & r) + ""); s.fillStyle = h, s.fillText(t, a / 2, 128); var d = new m.Texture(o); d.needsUpdate = !0; var p = new m.SpriteMaterial({ transparent: !0, depthTest: !1, map: d }); p.rotation = i; var f = new m.Sprite(p); return f.scale.set(a / 256 * n, n, 1), f.position.set(e.x, e.y, e.z), f; }, i.createTriangle = function (t, e, n) { if (!(t.length < 3)) {
|
|
6931
6944
|
for (var i = t.length, r = new m.Geometry, a = 0; a + 2 < i; a += 3) {
|
|
6932
6945
|
r.vertices.push(t[a]), r.vertices.push(t[a + 1]), r.vertices.push(t[a + 2]);
|
|
@@ -6936,7 +6949,7 @@ function mxfun() { !function a(o, s, l) { function c(e, t) { if (!s[e]) {
|
|
|
6936
6949
|
r.computeFaceNormals(), r.computeVertexNormals(), null == n && (n = 1);
|
|
6937
6950
|
var s = new m.MeshBasicMaterial({ color: e, transparent: !0, depthTest: !1, side: m.DoubleSide, opacity: n });
|
|
6938
6951
|
return new m.Mesh(r, s);
|
|
6939
|
-
} }, i.createLines = function (t, e, n) { var i, r = new m.Geometry; return r.vertices = t, i = n || 0 == n ? new m.LineBasicMaterial({ color: e, transparent: !0, depthTest: !1, opacity: n }) : new m.LineBasicMaterial({ color: e, transparent: !0, depthTest: !1 }), new m.Line(r, i); }, i.createDashedLines = function (t, e, n, i) { var r = new m.Geometry; r.vertices = t; var a = new m.Line(r, new m.LineDashedMaterial({ color: e, dashSize: n, gapSize: i, transparent: !0, depthTest: !1 })); return a.computeLineDistances(), a; };
|
|
6952
|
+
} }, i.createLines = function (t, e, n) { var i, r = new m.Geometry; return r.vertices = t, i = n && 1 != n || 0 == n ? new m.LineBasicMaterial({ color: e, transparent: !0, depthTest: !1, opacity: n }) : new m.LineBasicMaterial({ color: e, transparent: !0, depthTest: !1 }), new m.Line(r, i); }, i.createDashedLines = function (t, e, n, i) { var r = new m.Geometry; r.vertices = t; var a = new m.Line(r, new m.LineDashedMaterial({ color: e, dashSize: n, gapSize: i, transparent: !0, depthTest: !1 })); return a.computeLineDistances(), a; };
|
|
6940
6953
|
}, { "./MxFun": 45, three: 19 }], 59: [function (t, e, n) {
|
|
6941
6954
|
"use strict";
|
|
6942
6955
|
Object.defineProperty(n, "__esModule", { value: !0 }), n.MxPair = n.MxTools = void 0;
|
|
@@ -6950,7 +6963,7 @@ function mxfun() { !function a(o, s, l) { function c(e, t) { if (!s[e]) {
|
|
|
6950
6963
|
return !1; for (var r = i - 1, a = 0, o = t.x, s = t.y; a < i; ++a)
|
|
6951
6964
|
(e[a].y <= s && s < e[r].y || e[r].y <= s && s < e[a].y) && o - e[a].x < (e[r].x - e[a].x) * (s - e[a].y) / (e[r].y - e[a].y) && (n = !n), r = a; return n; }, i.calcArea = function (t) { var e = 0, n = !0, i = new Array(2), r = new s.Vector3, a = t.length; if (t.length < 2)
|
|
6952
6965
|
return e; for (var o = 0; o < a; o++)
|
|
6953
|
-
i[0] = i[1], i[1] = t[o], n ? (r = i[1], n = !1) : e += .5 * (i[1].x - i[0].x) * (i[0].y - r.y + (i[1].y - r.y)); return e < 0 && (e = -e), e; };
|
|
6966
|
+
i[0] = i[1], i[1] = t[o], n ? (r = i[1], n = !1) : e += .5 * (i[1].x - i[0].x) * (i[0].y - r.y + (i[1].y - r.y)); return e < 0 && (e = -e), e; }, i.MxASSERT = function (t, e) { t || console.log("MxASSERT(0):" + e); };
|
|
6954
6967
|
function r(t, e) { this.first = t, this.second = e; }
|
|
6955
6968
|
n.MxPair = r;
|
|
6956
6969
|
}, { three: 19 }], 60: [function (t, e, n) {
|
|
@@ -7122,7 +7135,7 @@ function mxfun() { !function a(o, s, l) { function c(e, t) { if (!s[e]) {
|
|
|
7122
7135
|
return !1; d.OnMxEvent(t); };
|
|
7123
7136
|
}, { "./MxCmdRunManager": 33, "./MxFun": 45, "./MxJigCmdManager": 48, "./MxTools": 59 }], 65: [function (t, e, n) {
|
|
7124
7137
|
"use strict";
|
|
7125
|
-
Object.defineProperty(n, "__esModule", { value: !0 }), n.MxBulid = void 0, window.MxDrawVersion = "1.0(2022-04-
|
|
7138
|
+
Object.defineProperty(n, "__esModule", { value: !0 }), n.MxBulid = void 0, window.MxDrawVersion = "1.0(2022-04-23 17:25)", (n.MxBulid || (n.MxBulid = {})).getVersion = function () { return window.MxDrawVersion ? window.MxDrawVersion : "inalid version"; };
|
|
7126
7139
|
}, {}], 66: [function (t, e, n) {
|
|
7127
7140
|
"use strict";
|
|
7128
7141
|
Object.defineProperty(n, "__esModule", { value: !0 }), n.MxWindowsEvent = void 0;
|
package/dist/lib/mxdraw.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MxType = exports.MrxDbgUiPrBaseReturn = exports.McGiWorldDrawType = exports.store = exports.loadCoreCode = exports.useCanvasResizeListener = exports.MxDbAlignedDimension = exports.MxDbRect = exports.MxDbSVG = exports.MxDbLine = exports.MxDbImage = exports.MxFilters = exports.MxDbEntity = exports.MrxDbgUiPrPoint = exports.McEdGetPointWorldDrawObject = exports.MxThreeJS = exports.Mxassembly = exports.MxFun = void 0;
|
|
3
|
+
exports.MxType = exports.MrxDbgUiPrBaseReturn = exports.McGiWorldDrawType = exports.store = exports.loadCoreCode = exports.useCanvasResizeListener = exports.MxDbAlignedDimension = exports.MxDbRect = exports.MxDbSVGText = exports.MxDbSVG = exports.MxDbLine = exports.MxDbImage = exports.MxFilters = exports.MxDbEntity = exports.MrxDbgUiPrPoint = exports.McEdGetPointWorldDrawObject = exports.MxThreeJS = exports.Mxassembly = exports.MxFun = void 0;
|
|
4
4
|
//src/index.ts
|
|
5
5
|
var loadCoreCode_1 = require("./MxModule/loadCoreCode");
|
|
6
6
|
exports.loadCoreCode = loadCoreCode_1.default;
|
|
@@ -24,6 +24,8 @@ var MxDbImage_1 = require("./MxModule/MxDbImage");
|
|
|
24
24
|
exports.MxDbImage = MxDbImage_1.default;
|
|
25
25
|
var MxDbSVG_1 = require("./MxModule/MxDbSVG");
|
|
26
26
|
exports.MxDbSVG = MxDbSVG_1.default;
|
|
27
|
+
var MxDbSVGText_1 = require("./MxModule/MxDbSVGText");
|
|
28
|
+
exports.MxDbSVGText = MxDbSVGText_1.default;
|
|
27
29
|
var MxDbLine_1 = require("./MxModule/MxDbLine");
|
|
28
30
|
exports.MxDbLine = MxDbLine_1.default;
|
|
29
31
|
var MxDbRect_1 = require("./MxModule/MxDbRect");
|
|
@@ -50,6 +52,7 @@ exports.default = {
|
|
|
50
52
|
MxDbImage: MxDbImage_1.default,
|
|
51
53
|
MxDbLine: MxDbLine_1.default,
|
|
52
54
|
MxDbSVG: MxDbSVG_1.default,
|
|
55
|
+
MxDbSVGText: MxDbSVGText_1.default,
|
|
53
56
|
MxDbRect: MxDbRect_1.default,
|
|
54
57
|
MxDbAlignedDimension: MxDbAlignedDimension_1.default,
|
|
55
58
|
useCanvasResizeListener: useCanvasResizeListener_1.default,
|
|
@@ -57,6 +57,9 @@ function getToGenerateRoundedCorners(points, cornerRadius, isClose) {
|
|
|
57
57
|
if (isClose === void 0) { isClose = true; }
|
|
58
58
|
if (cornerRadius.length > 0) {
|
|
59
59
|
var curve = new three_1.CurvePath();
|
|
60
|
+
if (!isClose) {
|
|
61
|
+
points.push(points[0]);
|
|
62
|
+
}
|
|
60
63
|
for (var i = 0; i < points.length - 1; i++) {
|
|
61
64
|
//作为拐弯的弧度
|
|
62
65
|
var R = cornerRadius[i] || 0;
|
|
@@ -65,16 +68,17 @@ function getToGenerateRoundedCorners(points, cornerRadius, isClose) {
|
|
|
65
68
|
dir.normalize();
|
|
66
69
|
var p2_1 = points[1].clone();
|
|
67
70
|
p2_1.add(dir.clone().multiplyScalar(R));
|
|
68
|
-
var
|
|
69
|
-
curve.curves.push(
|
|
71
|
+
var line = new three_1.LineCurve3(points[0], p2_1);
|
|
72
|
+
curve.curves.push(line);
|
|
70
73
|
continue;
|
|
71
74
|
}
|
|
72
75
|
// 计算三个点构成的两条线的方向
|
|
73
|
-
var dir1 = !isClose
|
|
76
|
+
var dir1 = !isClose || points[i - 1]
|
|
74
77
|
? points[i - 1].clone().sub(points[i])
|
|
75
78
|
: points[points.length - 1].clone().sub(points[0]);
|
|
76
79
|
dir1.normalize();
|
|
77
|
-
|
|
80
|
+
/* istanbul ignore next */
|
|
81
|
+
var dir2 = !isClose || points[i + 1]
|
|
78
82
|
? points[i + 1].clone().sub(points[i])
|
|
79
83
|
: points[1].clone().sub(points[0]);
|
|
80
84
|
dir2.normalize();
|
|
@@ -84,24 +88,26 @@ function getToGenerateRoundedCorners(points, cornerRadius, isClose) {
|
|
|
84
88
|
var p2 = points[i].clone();
|
|
85
89
|
var p3 = points[i].clone().add(dir2.clone().multiplyScalar(R));
|
|
86
90
|
var beziercurve = new three_1.QuadraticBezierCurve3(p1, p2, p3);
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
if (i === points.length - 2) {
|
|
92
|
+
var line1 = points[i].clone();
|
|
93
|
+
line1.add(dir2.clone().multiplyScalar(R));
|
|
94
|
+
var line2 = points[i + 1].clone();
|
|
95
|
+
isClose ? line2.add(dir2.clone().multiplyScalar(-R)) : line2.add(dir2.clone());
|
|
96
|
+
var line = new three_1.LineCurve3(line1, line2);
|
|
97
|
+
curve.curves.push(beziercurve, line);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
// 把转换曲线和直线插入曲线中
|
|
101
|
+
curve.curves.push(beziercurve);
|
|
93
102
|
}
|
|
94
|
-
var line = new three_1.LineCurve3(line1, line2);
|
|
95
|
-
// 把转换曲线和直线插入曲线中
|
|
96
|
-
curve.curves.push(beziercurve, line);
|
|
97
103
|
if (i === 0) {
|
|
98
104
|
points.push(points[0]);
|
|
99
105
|
}
|
|
100
106
|
}
|
|
101
|
-
return curve.getPoints(
|
|
107
|
+
return curve.getPoints(50);
|
|
102
108
|
}
|
|
103
109
|
else {
|
|
104
|
-
return
|
|
110
|
+
return points;
|
|
105
111
|
}
|
|
106
112
|
}
|
|
107
113
|
exports.getToGenerateRoundedCorners = getToGenerateRoundedCorners;
|