mxcad 1.0.43 → 1.0.45

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/mxcad.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import RD, { MrxDbgUiPrPoint as P, MxFun as p, store as R, MxPaintBrush as k, MrxDbgUiPrBaseReturn as h, MxDbCircleShape as AD, MrxDbgUtils as LD, MxDbLine as K, MxDbPolyline as vD, MxDbCircleArc as V, Mx3PointArc as SD, MxDbEllipseShape as OD } from "mxdraw";
1
+ import RD, { MrxDbgUiPrPoint as P, MxFun as m, store as R, MxPaintBrush as k, MrxDbgUiPrBaseReturn as h, MxDbCircleShape as AD, MrxDbgUtils as LD, MxDbLine as K, MxDbPolyline as vD, MxDbCircleArc as V, Mx3PointArc as SD, MxDbEllipseShape as OD } from "mxdraw";
2
2
  async function jD(B, D) {
3
3
  const E = await (await fetch(B)).arrayBuffer();
4
4
  return await WebAssembly.instantiate(E, D);
@@ -70,7 +70,7 @@ async function GD() {
70
70
  let C = "\u6D4B\u8BD5";
71
71
  if (C.length <= 0)
72
72
  return;
73
- let E = p.screenCoordLong2Doc(50);
73
+ let E = m.screenCoordLong2Doc(50);
74
74
  C = I.b64Encode(C);
75
75
  const F = {
76
76
  postx: D.x,
@@ -78,7 +78,7 @@ async function GD() {
78
78
  text: C,
79
79
  height: E
80
80
  };
81
- p.call("Mx_Text", F);
81
+ m.call("Mx_Text", F);
82
82
  }
83
83
  class WD extends AD {
84
84
  getGripPoints() {
@@ -92,7 +92,7 @@ class WD extends AD {
92
92
  }
93
93
  }
94
94
  const ED = (B) => {
95
- const [D, C, E] = B, { x: F, y: A, z: e } = D, { x: t, y: r, z: i } = C, { x: o, y: u, z: l } = E, s = A * i - r * e - A * l + u * e + r * l - u * i, a = -(F * i - t * e - F * l + o * e + t * l - o * i), m = F * r - t * A - F * u + o * A + t * u - o * r, d = -(F * r * l - F * u * i - t * A * l + t * u * e + o * A * i - o * r * e), c = 2 * (t - F), y = 2 * (r - A), g = 2 * (i - e), S = F * F + A * A + e * e - t * t - r * r - i * i, x = 2 * (o - F), f = 2 * (u - A), M = 2 * (l - e), O = F * F + A * A + e * e - o * o - u * u - l * l, kD = -(a * g * O - a * M * S - y * m * O + y * M * d + f * m * S - f * g * d) / (s * y * M - s * f * g - c * a * M + c * f * m + x * a * g - x * y * m), TD = (s * g * O - s * M * S - c * m * O + c * M * d + x * m * S - x * g * d) / (s * y * M - s * f * g - c * a * M + c * f * m + x * a * g - x * y * m), PD = -(s * y * O - s * f * S - c * a * O + c * f * d + x * a * S - x * y * d) / (s * y * M - s * f * g - c * a * M + c * f * m + x * a * g - x * y * m);
95
+ const [D, C, E] = B, { x: F, y: A, z: e } = D, { x: t, y: r, z: i } = C, { x: o, y: u, z: l } = E, s = A * i - r * e - A * l + u * e + r * l - u * i, a = -(F * i - t * e - F * l + o * e + t * l - o * i), p = F * r - t * A - F * u + o * A + t * u - o * r, d = -(F * r * l - F * u * i - t * A * l + t * u * e + o * A * i - o * r * e), c = 2 * (t - F), y = 2 * (r - A), g = 2 * (i - e), S = F * F + A * A + e * e - t * t - r * r - i * i, x = 2 * (o - F), f = 2 * (u - A), M = 2 * (l - e), O = F * F + A * A + e * e - o * o - u * u - l * l, kD = -(a * g * O - a * M * S - y * p * O + y * M * d + f * p * S - f * g * d) / (s * y * M - s * f * g - c * a * M + c * f * p + x * a * g - x * y * p), TD = (s * g * O - s * M * S - c * p * O + c * M * d + x * p * S - x * g * d) / (s * y * M - s * f * g - c * a * M + c * f * p + x * a * g - x * y * p), PD = -(s * y * O - s * f * S - c * a * O + c * f * d + x * a * S - x * y * d) / (s * y * M - s * f * g - c * a * M + c * f * p + x * a * g - x * y * p);
96
96
  return new THREE.Vector3(kD, TD, PD);
97
97
  };
98
98
  function sD() {
@@ -113,7 +113,7 @@ function sD() {
113
113
  B.setMessage(`
114
114
  \u6307\u5B9A\u5706\u7684\u534A\u5F84:`), B.setKeyWords("[\u76F4\u5F84(D)]"), D.center = B.value(), A();
115
115
  else if (C === 1)
116
- return p.getCurrentDraw().addMxEntity(D), !0;
116
+ return m.getCurrentDraw().addMxEntity(D), !0;
117
117
  C++;
118
118
  }
119
119
  s === h.kKeyWord && B.isKeyWordPicked("D") && (F = !1, A(), B.setMessage(`
@@ -124,19 +124,19 @@ function sD() {
124
124
  const r = (s) => {
125
125
  if (E === "3P" && (B.setMessage(`
126
126
  \u6307\u5B9A\u5706\u4E0A\u7684\u7B2C\u4E00\u4E2A\u70B9:`), s === h.kOk)) {
127
- if (C === 0 && (t.push(B.value()), B.setUserDraw((a, m) => {
128
- m.drawLine(t[0], a);
127
+ if (C === 0 && (t.push(B.value()), B.setUserDraw((a, p) => {
128
+ p.drawLine(t[0], a);
129
129
  }), B.setMessage(`
130
- \u6307\u5B9A\u5706\u4E0A\u7684\u7B2C\u4E8C\u4E2A\u70B9:`)), C === 1 && (t.push(B.value()), B.setUserDraw((a, m) => {
130
+ \u6307\u5B9A\u5706\u4E0A\u7684\u7B2C\u4E8C\u4E2A\u70B9:`)), C === 1 && (t.push(B.value()), B.setUserDraw((a, p) => {
131
131
  const [d, c] = t, y = a;
132
132
  D.center = ED([
133
133
  d,
134
134
  c,
135
135
  y
136
- ]), D.radius = D.center.distanceTo(d), m.drawCustomEntity(D);
136
+ ]), D.radius = D.center.distanceTo(d), p.drawCustomEntity(D);
137
137
  }), B.setMessage(`
138
138
  \u6307\u5B9A\u5706\u4E0A\u7684\u7B2C\u4E09\u4E2A\u70B9:`)), C === 2)
139
- return t.push(B.value()), D.center = ED(t), D.radius = D.center.distanceTo(t[0]), p.getCurrentDraw().addMxEntity(D), !0;
139
+ return t.push(B.value()), D.center = ED(t), D.radius = D.center.distanceTo(t[0]), m.getCurrentDraw().addMxEntity(D), !0;
140
140
  C++;
141
141
  }
142
142
  };
@@ -146,11 +146,11 @@ function sD() {
146
146
  }, u = (s) => {
147
147
  if (E === "2P" && (B.setMessage(`
148
148
  \u6307\u5B9A\u5706\u76F4\u5F84\u7684\u7B2C\u4E00\u4E2A\u7AEF\u70B9:`), s === h.kOk)) {
149
- if (C === 0 && (i = B.value(), B.setUserDraw((a, m) => {
150
- o(i, a), m.drawCustomEntity(D), m.drawLine(i, a);
149
+ if (C === 0 && (i = B.value(), B.setUserDraw((a, p) => {
150
+ o(i, a), p.drawCustomEntity(D), p.drawLine(i, a);
151
151
  }), B.setMessage(`
152
152
  \u6307\u5B9A\u5706\u76F4\u5F84\u7684\u7B2C\u4E8C\u4E2A\u7AEF\u70B9:`)), C === 1)
153
- return o(i, B.value()), p.getCurrentDraw().addMxEntity(D), !0;
153
+ return o(i, B.value()), m.getCurrentDraw().addMxEntity(D), !0;
154
154
  C++;
155
155
  }
156
156
  }, l = (s) => {
@@ -159,7 +159,7 @@ function sD() {
159
159
  \u6307\u5B9A\u5BF9\u8C61\u4E0E\u5706\u7684\u7B2C\u4E00\u4E2A\u5207\u70B9:`), s === h.kOk) {
160
160
  if (C === 0) {
161
161
  const a = B.value();
162
- console.log(a), p.getCurrentDraw();
162
+ console.log(a), m.getCurrentDraw();
163
163
  }
164
164
  C++;
165
165
  }
@@ -181,12 +181,12 @@ function sD() {
181
181
  return { exit: !0 };
182
182
  },
183
183
  (s) => {
184
- s === h.kCancel && p.getCurrentDraw().addMxEntity(D);
184
+ s === h.kCancel && m.getCurrentDraw().addMxEntity(D);
185
185
  }
186
186
  );
187
187
  }
188
188
  R.events.on("MxDbEntityRegister", () => {
189
- p.addCommand("Mx_Circle", sD);
189
+ m.addCommand("Mx_Circle", sD);
190
190
  });
191
191
  var Q;
192
192
  (function(B) {
@@ -733,7 +733,7 @@ class HD {
733
733
  NewMcGePoint3d(D, C) {
734
734
  if (C && D && D.x && D.y) {
735
735
  let F = D.z || 0;
736
- D = p.getCurrentDraw().docCoord2Cad(D.x, D.y, F);
736
+ D = m.getCurrentDraw().docCoord2Cad(D.x, D.y, F);
737
737
  }
738
738
  let E = new this.mxcadassemblyimp.MdGePoint3d();
739
739
  return D && D.x && D.y && (E.x = D.x, E.y = D.y, D.z && (E.y = D.z)), E;
@@ -1140,7 +1140,7 @@ class T {
1140
1140
  return this.type != 2 && !this.id;
1141
1141
  }
1142
1142
  erase() {
1143
- this.type == 1 ? p.getCurrentDraw().eraseMxEntity(this.id) : this.type == 0 && CD.eraseEntity(this.id);
1143
+ this.type == 1 ? m.getCurrentDraw().eraseMxEntity(this.id) : this.type == 0 && CD.eraseEntity(this.id);
1144
1144
  }
1145
1145
  getMcDbObject() {
1146
1146
  return this.type == 0 ? n.App.ObjectIdToObject(this.id) : null;
@@ -1149,14 +1149,14 @@ class T {
1149
1149
  if (this.type == 0)
1150
1150
  return n.App.getImp().ObjectIdToObjectName(this.id);
1151
1151
  if (this.type == 1) {
1152
- let D = p.getCurrentDraw().getMxEntity(this.id);
1152
+ let D = m.getCurrentDraw().getMxEntity(this.id);
1153
1153
  if (D)
1154
1154
  return D.getTypeName();
1155
1155
  }
1156
1156
  return "";
1157
1157
  }
1158
1158
  getMxDbEntity() {
1159
- return this.type == 1 ? p.getCurrentDraw().getMxEntity(this.id) : null;
1159
+ return this.type == 1 ? m.getCurrentDraw().getMxEntity(this.id) : null;
1160
1160
  }
1161
1161
  }
1162
1162
  class $D {
@@ -1358,7 +1358,7 @@ async function hD() {
1358
1358
  }
1359
1359
  },
1360
1360
  (A) => (A === h.kCancel && C.forEach((e) => {
1361
- p.getCurrentDraw().addMxEntity(e);
1361
+ m.getCurrentDraw().addMxEntity(e);
1362
1362
  }), { exit: !0 })
1363
1363
  );
1364
1364
  }
@@ -1371,7 +1371,7 @@ async function YD() {
1371
1371
  if (!D)
1372
1372
  return;
1373
1373
  let C = new H(), E = new _();
1374
- E.textString = "\u6D4B\u8BD5Test", E.height = p.viewCoordLong2Cad(100), C.startPoint = n.NewMcGePoint3d(D), B.setUserDraw((r, i) => {
1374
+ E.textString = "\u6D4B\u8BD5Test", E.height = m.viewCoordLong2Cad(100), C.startPoint = n.NewMcGePoint3d(D), B.setUserDraw((r, i) => {
1375
1375
  C.endPoint = n.NewMcGePoint3d(r), E.position = n.NewMcGePoint3d(r), E.alignmentPoint = E.position, i.drawMcDbEntity(C), i.drawMcDbEntity(E);
1376
1376
  }), B.setMessage(`
1377
1377
  \u6307\u5B9A\u4E8C\u70B9:`), await B.go();
@@ -1407,7 +1407,7 @@ async function QD() {
1407
1407
  }
1408
1408
  }
1409
1409
  R.events.on("MxDbEntityRegister", () => {
1410
- p.addCommand("Mx_Line", hD), p.addCommand("Mx_TestDraw", YD), p.addCommand("Mx_Test_GetDim", QD);
1410
+ m.addCommand("Mx_Line", hD), m.addCommand("Mx_TestDraw", YD), m.addCommand("Mx_Test_GetDim", QD);
1411
1411
  });
1412
1412
  async function ZD() {
1413
1413
  const B = new P();
@@ -1420,7 +1420,7 @@ async function ZD() {
1420
1420
  \u6D4B\u8BD5`;
1421
1421
  if (C.length <= 0)
1422
1422
  return;
1423
- let E = p.screenCoordLong2Doc(50);
1423
+ let E = m.screenCoordLong2Doc(50);
1424
1424
  C = I.b64Encode(C);
1425
1425
  const F = {
1426
1426
  postx: D.x,
@@ -1428,7 +1428,7 @@ async function ZD() {
1428
1428
  text: C,
1429
1429
  height: E
1430
1430
  };
1431
- p.call("Mx_MText", F);
1431
+ m.call("Mx_MText", F);
1432
1432
  }
1433
1433
  async function wD() {
1434
1434
  const B = new P(), D = new vD();
@@ -1447,12 +1447,12 @@ async function wD() {
1447
1447
  E === h.kKeyWord && (B.isKeyWordPicked("A"), B.isKeyWordPicked("W"));
1448
1448
  },
1449
1449
  (E) => {
1450
- E === h.kCancel && p.getCurrentDraw().addMxEntity(D);
1450
+ E === h.kCancel && m.getCurrentDraw().addMxEntity(D);
1451
1451
  }
1452
1452
  );
1453
1453
  }
1454
1454
  R.events.on("MxDbEntityRegister", () => {
1455
- p.addCommand("Mx_Pline", wD);
1455
+ m.addCommand("Mx_Pline", wD);
1456
1456
  });
1457
1457
  async function yD() {
1458
1458
  const B = new P();
@@ -1472,10 +1472,10 @@ async function yD() {
1472
1472
  \u6307\u5B9A\u4E8C\u70B9:`), await B.go(), B.drawReserve();
1473
1473
  }
1474
1474
  R.events.on("MxDbEntityRegister", () => {
1475
- p.addCommand("Mx_Polygon", yD);
1475
+ m.addCommand("Mx_Polygon", yD);
1476
1476
  });
1477
1477
  function DC(B, D, C) {
1478
- const E = B.x, F = D.x, A = C.x, e = B.y, t = D.y, r = C.y, i = E - F, o = e - t, u = E - A, l = e - r, s = (E * E - F * F + (e * e - t * t)) / 2, a = (E * E - A * A + (e * e - r * r)) / 2, m = o * u - i * l, d = -(l * s - o * a) / m, c = -(i * a - u * s) / m;
1478
+ const E = B.x, F = D.x, A = C.x, e = B.y, t = D.y, r = C.y, i = E - F, o = e - t, u = E - A, l = e - r, s = (E * E - F * F + (e * e - t * t)) / 2, a = (E * E - A * A + (e * e - r * r)) / 2, p = o * u - i * l, d = -(l * s - o * a) / p, c = -(i * a - u * s) / p;
1479
1479
  return new THREE.Vector3(d, c, 0);
1480
1480
  }
1481
1481
  function CC(B, D) {
@@ -1614,7 +1614,7 @@ async function bD() {
1614
1614
  const l = b(
1615
1615
  B,
1616
1616
  () => {
1617
- u = B.value(), F.startPoint = u, F.endPoint = r, p.getCurrentDraw().addMxEntity(F);
1617
+ u = B.value(), F.startPoint = u, F.endPoint = r, m.getCurrentDraw().addMxEntity(F);
1618
1618
  },
1619
1619
  () => {
1620
1620
  if (B.isKeyWordPicked("A"))
@@ -1649,7 +1649,7 @@ async function bD() {
1649
1649
  s = B.value(), B.setMessage(`
1650
1650
  \u6307\u5B9A\u5706\u5F27\u7684\u7AEF\u70B9:`), E = new SD(), E.autoClockwise = !0, E.closed = !1, k.use(E), E.point1 = C, E.point3 = s, D.center, B.setUserDraw((d, c) => {
1651
1651
  E.point2 = d, c.drawCustomEntity(D);
1652
- }), m();
1652
+ }), p();
1653
1653
  },
1654
1654
  () => {
1655
1655
  if (B.isKeyWordPicked("C"))
@@ -1665,10 +1665,10 @@ async function bD() {
1665
1665
  else
1666
1666
  return !0;
1667
1667
  }
1668
- ), m = b(
1668
+ ), p = b(
1669
1669
  B,
1670
1670
  () => {
1671
- E.point1 = C, E.point2 = B.value(), E.point3 = s, p.getCurrentDraw().addMxEntity(E);
1671
+ E.point1 = C, E.point2 = B.value(), E.point3 = s, m.getCurrentDraw().addMxEntity(E);
1672
1672
  },
1673
1673
  () => {
1674
1674
  if (B.isKeyWordPicked("C"))
@@ -1682,7 +1682,7 @@ async function bD() {
1682
1682
  A();
1683
1683
  }
1684
1684
  R.events.on("MxDbEntityRegister", () => {
1685
- p.addCommand("Mx_Arc", bD);
1685
+ m.addCommand("Mx_Arc", bD);
1686
1686
  });
1687
1687
  function gD() {
1688
1688
  const B = new P(), D = new OD();
@@ -1734,14 +1734,14 @@ function gD() {
1734
1734
  ), r = b(
1735
1735
  B,
1736
1736
  () => {
1737
- p.getCurrentDraw().addMxEntity(D);
1737
+ m.getCurrentDraw().addMxEntity(D);
1738
1738
  },
1739
1739
  () => {
1740
1740
  }
1741
1741
  );
1742
1742
  }
1743
1743
  R.events.on("MxDbEntityRegister", () => {
1744
- p.addCommand("Mx_EllipseArc", gD);
1744
+ m.addCommand("Mx_EllipseArc", gD);
1745
1745
  });
1746
1746
  async function xD() {
1747
1747
  (await CD.selectEnt(`
@@ -1750,7 +1750,7 @@ async function xD() {
1750
1750
  });
1751
1751
  }
1752
1752
  R.events.on("MxDbEntityRegister", () => {
1753
- p.addCommand("Mx_Erase", xD);
1753
+ m.addCommand("Mx_Erase", xD);
1754
1754
  });
1755
1755
  const EC = (B) => new Promise((D, C) => {
1756
1756
  const E = document.createElement("script");
@@ -1774,7 +1774,7 @@ const EC = (B) => new Promise((D, C) => {
1774
1774
  console.log(a);
1775
1775
  }
1776
1776
  const s = await Y(o, "application/wasm");
1777
- return await EC(u), l && (C.mainScriptUrlOrBlob = r), C.locateFile = (a, m) => a === u ? m : a === i && l ? l : a === o ? s : F(a, m), await window[D](C);
1777
+ return await EC(u), l && (C.mainScriptUrlOrBlob = u), C.locateFile = (a, p) => a === A ? u : a === e && l ? l : a === t ? s : F(a, p), await window[D](C);
1778
1778
  };
1779
1779
  function FC(B) {
1780
1780
  return typeof ResizeObserver == "function" ? new ResizeObserver(B) : null;
@@ -1807,8 +1807,8 @@ class G {
1807
1807
  const u = this.canvas.parentElement?.clientWidth || window.innerWidth, l = this.canvas.parentElement?.clientHeight || window.innerHeight;
1808
1808
  let s = Math.min(u, window.screen.availWidth), a = Math.min(l, window.screen.availHeight);
1809
1809
  s = Math.max(A, s), a = Math.max(e, a), this.canvas.style.width = s + 1 + "px", this.canvas.style.height = a + "px";
1810
- const m = window.devicePixelRatio || 1;
1811
- this.canvas.width = s * m, this.canvas.height = a * m;
1810
+ const p = window.devicePixelRatio || 1;
1811
+ this.canvas.width = s * p, this.canvas.height = a * p;
1812
1812
  }, E = eC(C, 50), {
1813
1813
  canvas: F,
1814
1814
  minWidth: A = 300,
@@ -1839,7 +1839,7 @@ class G {
1839
1839
  });
1840
1840
  }
1841
1841
  }
1842
- const MD = "1.0.42", tC = (B, D = self.location.href) => typeof process < "u" && process.env.NODE_ENV === "development" ? new URL(`/node_modules/mxcad/dist/wasm/2d/${B}`, import.meta.url || D).href : `https://unpkg.com/mxcad@${MD}/dist/wasm/2d/${B}`, iC = (B, D = self.location.href) => typeof process < "u" && process.env.NODE_ENV === "development" ? new URL(`/node_modules/mxcad/dist/wasm/3d/${B}`, import.meta.url || D).href : `https://unpkg.com/mxcad@${MD}/dist/wasm/3d/${B}`;
1842
+ const MD = "1.0.44", tC = (B, D = self.location.href) => typeof process < "u" && process.env.NODE_ENV === "development" ? new URL(`/node_modules/mxcad/dist/wasm/2d/${B}`, import.meta.url || D).href : `https://unpkg.com/mxcad@${MD}/dist/wasm/2d/${B}`, iC = (B, D = self.location.href) => typeof process < "u" && process.env.NODE_ENV === "development" ? new URL(`/node_modules/mxcad/dist/wasm/3d/${B}`, import.meta.url || D).href : `https://unpkg.com/mxcad@${MD}/dist/wasm/3d/${B}`;
1843
1843
  let n;
1844
1844
  async function rC(B, D = tC, C) {
1845
1845
  if (n || (n = new HD()), n.mxcadassemblyimp) {
package/dist/mxcad.umd.js CHANGED
@@ -35,4 +35,4 @@
35
35
  \u6307\u5B9A\u53E6\u4E00\u6761\u534A\u8F74\u957F\u5EA6`),B.setKeyWords(""),e()},()=>{}),e=y(B,()=>{B.setMessage(`
36
36
  \u6307\u5B9A\u8D77\u59CB\u89D2\u5EA6`),B.setKeyWords(""),B.setUserDraw((n,o)=>{D.startAngle=FD(n.x,n.y,E.x,E.y)-D.rotation,o.drawLine(E,n),o.drawCustomEntity(D)}),i()},()=>{}),i=y(B,()=>{B.setUserDraw((n,o)=>{D.endAngle=FD(n.x,n.y,E.x,E.y)-D.rotation,o.drawLine(E,n),o.drawCustomEntity(D)}),B.setMessage(`
37
37
  \u6307\u5B9A\u7EC8\u6B62\u89D2\u5EA6`),B.setKeyWords(""),s()},()=>{}),s=y(B,()=>{r.MxFun.getCurrentDraw().addMxEntity(D)},()=>{})}r.store.events.on("MxDbEntityRegister",()=>{r.MxFun.addCommand("Mx_EllipseArc",sD)});async function aD(){(await K.selectEnt(`
38
- \u9009\u62E9\u5220\u9664\u5BF9\u8C61`)).forEach(D=>{D.erase()})}r.store.events.on("MxDbEntityRegister",()=>{r.MxFun.addCommand("Mx_Erase",aD)});const _D=B=>new Promise((D,C)=>{const E=document.createElement("script");E.src=B,E.crossOrigin="anonymous",document.body.appendChild(E),E.onload=()=>{D()},E.onerror=F=>{C(F)}}),oD=async(B,D)=>{console.log("info",`fetch ${B}`);const C=await(await fetch(B)).arrayBuffer();console.log("info",`${B} file size = ${C.byteLength} bytes`);const E=new Blob([C],{type:D}),F=URL.createObjectURL(E);return console.log("info",`${B} blob URL = ${F}`),F},bD=async(B,D,C)=>{const{locateFile:E}=C,F=(...u)=>E(...u),A=B+".js",e=B+".worker.js",i=B+".wasm",s=F(A),n=F(e),o=F(i),l=await oD(s,"application/javascript");let c;try{c=await oD(n,"application/javascript")}catch(u){console.log(u)}const a=await oD(o,"application/wasm");return await _D(l),c&&(C.mainScriptUrlOrBlob=s),C.locateFile=(u,p)=>u===l?p:u===n&&c?c:u===o?a:F(u,p),await window[D](C)};function zD(B){return typeof ResizeObserver=="function"?new ResizeObserver(B):null}function HD(B,D){const C=()=>requestAnimationFrame(D);let E=zD(C);if(E){E.observe(B);return}if(MutationObserver){new MutationObserver(C).observe(B,{attributes:!0});return}}function qD(B,D){let C=null;return function(...E){C||(C=setTimeout(()=>{B.apply(this,E),C=null},D))}}class L{static onloadWasmMxDraw3dModel;canvas;constructor(D){const C=()=>{const l=this.canvas.parentElement?.clientWidth||window.innerWidth,c=this.canvas.parentElement?.clientHeight||window.innerHeight;let a=Math.min(l,window.screen.availWidth),u=Math.min(c,window.screen.availHeight);a=Math.max(A,a),u=Math.max(e,u),this.canvas.style.width=a+1+"px",this.canvas.style.height=u+"px";const p=window.devicePixelRatio||1;this.canvas.width=a*p,this.canvas.height=u*p},E=qD(C,50),{canvas:F,minWidth:A=300,minHeight:e=300,updateCanvasSize:i=E,...s}=D;let n=typeof F=="string"?document.querySelectorAll(F)[0]:F,o=n.getContext("webgl2",{alpha:!1,depth:!0,antialias:!1,preserveDrawingBuffer:!0});o==null&&(o=n.getContext("webgl",{alpha:!1,depth:!0,antialias:!1,preserveDrawingBuffer:!0})),this.canvas=n,this.ctx=o,s.canvas=this.canvas;for(let l in s)this[l]=s[l];if(this.canvas instanceof HTMLCanvasElement){const l=this.canvas.parentElement||document.body;HD(l,i)}else console.error("createMxDraw3d canvas \u53C2\u6570\u4E0D\u6B63\u786E \u65E0\u6CD5\u83B7\u53D6\u5230canvas\u5143\u7D20");window.onresize=C,C(),bD("mxdraw3d_min","mxdraw3d",this).then(()=>{L.onloadWasmMxDraw3dModel&&L.onloadWasmMxDraw3dModel(this),this.updateCanvasSize=i,this.open3DFile=l=>{const c=new FileReader;c.onload=()=>{if(!!c.result&&c.result instanceof ArrayBuffer){var a=new Uint8Array(c.result);const u=this._malloc(a.length);this.HEAPU8.set(a,u),this.openFromMemory(l.name,u,a.length,!0),this.displayGround(!0),this.canvas.focus()}},c.readAsArrayBuffer(l)}})}}const wD="1.0.42",$D=(B,D=self.location.href)=>typeof process<"u"&&process.env.NODE_ENV==="development"?new URL(`/node_modules/mxcad/dist/wasm/2d/${B}`,(typeof document>"u"&&typeof location>"u"?new(require("url")).URL("file:"+__filename).href:typeof document>"u"?location.href:document.currentScript&&document.currentScript.src||new URL("mxcad.umd.js",document.baseURI).href)||D).href:`https://unpkg.com/mxcad@${wD}/dist/wasm/2d/${B}`,JD=(B,D=self.location.href)=>typeof process<"u"&&process.env.NODE_ENV==="development"?new URL(`/node_modules/mxcad/dist/wasm/3d/${B}`,(typeof document>"u"&&typeof location>"u"?new(require("url")).URL("file:"+__filename).href:typeof document>"u"?location.href:document.currentScript&&document.currentScript.src||new URL("mxcad.umd.js",document.baseURI).href)||D).href:`https://unpkg.com/mxcad@${wD}/dist/wasm/3d/${B}`;t.MxCpp=void 0;async function yD(B,D=$D,C){if(t.MxCpp||(t.MxCpp=new vD),t.MxCpp.mxcadassemblyimp){B(t.MxCpp);return}const F=await bD("mxdrawassembly_min","mxdrawassembly",{locateFile:D,wasmBinary:C});t.MxCpp.mxcadassemblyimp=F;let A=new F.McApp;A.Init(),t.MxCpp.App.init(A),B(t.MxCpp)}function gD(B,D){return new Promise(async(C,E)=>{try{B.locateFile||(B.locateFile=JD);const F=new L(B);L.onloadWasmMxDraw3dModel=()=>{C(F),D&&D(F)}}catch(F){E(F)}})}const XD=Object.freeze(Object.defineProperty({__proto__:null,fetchAndInstantiate:uD,b64Encode:z,b64Decode:H,saveAsFileDialog:q,downloadFile:$,MxTools:v,drawText:lD,drawCircle:J,drawLine:AD,drawMText:hD,drawPolyLine:eD,drawPolygon:tD,drawArc:nD,drawEllipticalArc:sD,mxErase:aD,McObject:R,McRxObject:P,McDbDatabase:Q,McDbLayerTable:Y,McDbEntity:k,McDbCurve:j,McDbLine:U,McDbText:G,McDbCircle:N,get McDb(){return t.McDb},McDrawUtility:K,McObjectId:w,McDrawResbuf:DD,McDbPolyline:Z,McDbBlockTable:ED,McDbBlockTableIterator:BD,McDbBlockTableRecord:W,McDbBlockTableRecordIterator:CD,MxDraw3d:L,get MxCpp(){return t.MxCpp},loadMxCADassembly:yD,loadMxCADassembly3d:gD},Symbol.toStringTag,{value:"Module"}));t.McDbBlockTable=ED,t.McDbBlockTableIterator=BD,t.McDbBlockTableRecord=W,t.McDbBlockTableRecordIterator=CD,t.McDbCircle=N,t.McDbCurve=j,t.McDbDatabase=Q,t.McDbEntity=k,t.McDbLayerTable=Y,t.McDbLine=U,t.McDbPolyline=Z,t.McDbText=G,t.McDrawResbuf=DD,t.McDrawUtility=K,t.McObject=R,t.McObjectId=w,t.McRxObject=P,t.MxDraw3d=L,t.MxTools=v,t.b64Decode=H,t.b64Encode=z,t.default=XD,t.downloadFile=$,t.drawArc=nD,t.drawCircle=J,t.drawEllipticalArc=sD,t.drawLine=AD,t.drawMText=hD,t.drawPolyLine=eD,t.drawPolygon=tD,t.drawText=lD,t.fetchAndInstantiate=uD,t.loadMxCADassembly=yD,t.loadMxCADassembly3d=gD,t.mxErase=aD,t.saveAsFileDialog=q,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
38
+ \u9009\u62E9\u5220\u9664\u5BF9\u8C61`)).forEach(D=>{D.erase()})}r.store.events.on("MxDbEntityRegister",()=>{r.MxFun.addCommand("Mx_Erase",aD)});const _D=B=>new Promise((D,C)=>{const E=document.createElement("script");E.src=B,E.crossOrigin="anonymous",document.body.appendChild(E),E.onload=()=>{D()},E.onerror=F=>{C(F)}}),oD=async(B,D)=>{console.log("info",`fetch ${B}`);const C=await(await fetch(B)).arrayBuffer();console.log("info",`${B} file size = ${C.byteLength} bytes`);const E=new Blob([C],{type:D}),F=URL.createObjectURL(E);return console.log("info",`${B} blob URL = ${F}`),F},bD=async(B,D,C)=>{const{locateFile:E}=C,F=(...u)=>E(...u),A=B+".js",e=B+".worker.js",i=B+".wasm",s=F(A),n=F(e),o=F(i),l=await oD(s,"application/javascript");let c;try{c=await oD(n,"application/javascript")}catch(u){console.log(u)}const a=await oD(o,"application/wasm");return await _D(l),c&&(C.mainScriptUrlOrBlob=l),C.locateFile=(u,p)=>u===A?l:u===e&&c?c:u===i?a:F(u,p),await window[D](C)};function zD(B){return typeof ResizeObserver=="function"?new ResizeObserver(B):null}function HD(B,D){const C=()=>requestAnimationFrame(D);let E=zD(C);if(E){E.observe(B);return}if(MutationObserver){new MutationObserver(C).observe(B,{attributes:!0});return}}function qD(B,D){let C=null;return function(...E){C||(C=setTimeout(()=>{B.apply(this,E),C=null},D))}}class L{static onloadWasmMxDraw3dModel;canvas;constructor(D){const C=()=>{const l=this.canvas.parentElement?.clientWidth||window.innerWidth,c=this.canvas.parentElement?.clientHeight||window.innerHeight;let a=Math.min(l,window.screen.availWidth),u=Math.min(c,window.screen.availHeight);a=Math.max(A,a),u=Math.max(e,u),this.canvas.style.width=a+1+"px",this.canvas.style.height=u+"px";const p=window.devicePixelRatio||1;this.canvas.width=a*p,this.canvas.height=u*p},E=qD(C,50),{canvas:F,minWidth:A=300,minHeight:e=300,updateCanvasSize:i=E,...s}=D;let n=typeof F=="string"?document.querySelectorAll(F)[0]:F,o=n.getContext("webgl2",{alpha:!1,depth:!0,antialias:!1,preserveDrawingBuffer:!0});o==null&&(o=n.getContext("webgl",{alpha:!1,depth:!0,antialias:!1,preserveDrawingBuffer:!0})),this.canvas=n,this.ctx=o,s.canvas=this.canvas;for(let l in s)this[l]=s[l];if(this.canvas instanceof HTMLCanvasElement){const l=this.canvas.parentElement||document.body;HD(l,i)}else console.error("createMxDraw3d canvas \u53C2\u6570\u4E0D\u6B63\u786E \u65E0\u6CD5\u83B7\u53D6\u5230canvas\u5143\u7D20");window.onresize=C,C(),bD("mxdraw3d_min","mxdraw3d",this).then(()=>{L.onloadWasmMxDraw3dModel&&L.onloadWasmMxDraw3dModel(this),this.updateCanvasSize=i,this.open3DFile=l=>{const c=new FileReader;c.onload=()=>{if(!!c.result&&c.result instanceof ArrayBuffer){var a=new Uint8Array(c.result);const u=this._malloc(a.length);this.HEAPU8.set(a,u),this.openFromMemory(l.name,u,a.length,!0),this.displayGround(!0),this.canvas.focus()}},c.readAsArrayBuffer(l)}})}}const wD="1.0.44",$D=(B,D=self.location.href)=>typeof process<"u"&&process.env.NODE_ENV==="development"?new URL(`/node_modules/mxcad/dist/wasm/2d/${B}`,(typeof document>"u"&&typeof location>"u"?new(require("url")).URL("file:"+__filename).href:typeof document>"u"?location.href:document.currentScript&&document.currentScript.src||new URL("mxcad.umd.js",document.baseURI).href)||D).href:`https://unpkg.com/mxcad@${wD}/dist/wasm/2d/${B}`,JD=(B,D=self.location.href)=>typeof process<"u"&&process.env.NODE_ENV==="development"?new URL(`/node_modules/mxcad/dist/wasm/3d/${B}`,(typeof document>"u"&&typeof location>"u"?new(require("url")).URL("file:"+__filename).href:typeof document>"u"?location.href:document.currentScript&&document.currentScript.src||new URL("mxcad.umd.js",document.baseURI).href)||D).href:`https://unpkg.com/mxcad@${wD}/dist/wasm/3d/${B}`;t.MxCpp=void 0;async function yD(B,D=$D,C){if(t.MxCpp||(t.MxCpp=new vD),t.MxCpp.mxcadassemblyimp){B(t.MxCpp);return}const F=await bD("mxdrawassembly_min","mxdrawassembly",{locateFile:D,wasmBinary:C});t.MxCpp.mxcadassemblyimp=F;let A=new F.McApp;A.Init(),t.MxCpp.App.init(A),B(t.MxCpp)}function gD(B,D){return new Promise(async(C,E)=>{try{B.locateFile||(B.locateFile=JD);const F=new L(B);L.onloadWasmMxDraw3dModel=()=>{C(F),D&&D(F)}}catch(F){E(F)}})}const XD=Object.freeze(Object.defineProperty({__proto__:null,fetchAndInstantiate:uD,b64Encode:z,b64Decode:H,saveAsFileDialog:q,downloadFile:$,MxTools:v,drawText:lD,drawCircle:J,drawLine:AD,drawMText:hD,drawPolyLine:eD,drawPolygon:tD,drawArc:nD,drawEllipticalArc:sD,mxErase:aD,McObject:R,McRxObject:P,McDbDatabase:Q,McDbLayerTable:Y,McDbEntity:k,McDbCurve:j,McDbLine:U,McDbText:G,McDbCircle:N,get McDb(){return t.McDb},McDrawUtility:K,McObjectId:w,McDrawResbuf:DD,McDbPolyline:Z,McDbBlockTable:ED,McDbBlockTableIterator:BD,McDbBlockTableRecord:W,McDbBlockTableRecordIterator:CD,MxDraw3d:L,get MxCpp(){return t.MxCpp},loadMxCADassembly:yD,loadMxCADassembly3d:gD},Symbol.toStringTag,{value:"Module"}));t.McDbBlockTable=ED,t.McDbBlockTableIterator=BD,t.McDbBlockTableRecord=W,t.McDbBlockTableRecordIterator=CD,t.McDbCircle=N,t.McDbCurve=j,t.McDbDatabase=Q,t.McDbEntity=k,t.McDbLayerTable=Y,t.McDbLine=U,t.McDbPolyline=Z,t.McDbText=G,t.McDrawResbuf=DD,t.McDrawUtility=K,t.McObject=R,t.McObjectId=w,t.McRxObject=P,t.MxDraw3d=L,t.MxTools=v,t.b64Decode=H,t.b64Encode=z,t.default=XD,t.downloadFile=$,t.drawArc=nD,t.drawCircle=J,t.drawEllipticalArc=sD,t.drawLine=AD,t.drawMText=hD,t.drawPolyLine=eD,t.drawPolygon=tD,t.drawText=lD,t.fetchAndInstantiate=uD,t.loadMxCADassembly=yD,t.loadMxCADassembly3d=gD,t.mxErase=aD,t.saveAsFileDialog=q,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mxcad",
3
- "version": "1.0.43",
3
+ "version": "1.0.45",
4
4
  "main": "./dist/mxcad.umd.js",
5
5
  "module": "./dist/mxcad.es.js",
6
6
  "typings": "dist/mxcad.d.ts",
@@ -29,7 +29,8 @@
29
29
  "cz": "czg",
30
30
  "dev:docs": "node docs/typedoc.js && vitepress dev docs",
31
31
  "build:docs": "node docs/typedoc.js && vitepress build docs",
32
- "pub": "npm run add-commit && release-it",
32
+ "npm-pub": "npm run add-commit && release-it",
33
+ "docs-pub": "docs-deploy.sh",
33
34
  "add-commit": "npm run build && git add docs dist && npx git-cz",
34
35
  "pub-init": "git init && git remote add origin https://github.com/mxcad/mxcad_docs.git -f && git add docs dist && git commit -m\"init\" && git branch --set-upstream-to=origin/master master",
35
36
  "test:coverage": "jest --runInBand --coverage",