@mlightcad/cad-simple-viewer 1.0.20 → 1.0.21
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/index.js +406 -406
- package/dist/index.umd.cjs +9 -9
- package/lib/view/AcTrView2d.d.ts.map +1 -1
- package/lib/view/AcTrView2d.js +111 -41
- package/lib/view/AcTrView2d.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -245,10 +245,10 @@ const z = class z {
|
|
|
245
245
|
i || (i = t);
|
|
246
246
|
let s = this._defaultCommandGroup;
|
|
247
247
|
if (e) {
|
|
248
|
-
const
|
|
249
|
-
(
|
|
248
|
+
const r = this._commandsByGroup.find(
|
|
249
|
+
(o) => o.groupName == e
|
|
250
250
|
);
|
|
251
|
-
|
|
251
|
+
r ? s = r : s = {
|
|
252
252
|
groupName: e,
|
|
253
253
|
commandsByGlobalName: /* @__PURE__ */ new Map(),
|
|
254
254
|
commandsByLocalName: /* @__PURE__ */ new Map()
|
|
@@ -427,7 +427,7 @@ class ri {
|
|
|
427
427
|
* @returns Return svg string of the icon
|
|
428
428
|
*/
|
|
429
429
|
createRectCrossIcon(e, t, i = "white") {
|
|
430
|
-
const n = e / 2, s = e + 2 * t,
|
|
430
|
+
const n = e / 2, s = e + 2 * t, r = `
|
|
431
431
|
<svg xmlns="http://www.w3.org/2000/svg" width="${s}" height="${s}" viewBox="0 0 ${s} ${s}">
|
|
432
432
|
<rect x="${t}" y="${t}" width="${e}" height="${e}" fill="none" stroke="${i}" />
|
|
433
433
|
<line x1="${n + t}" y1="0" x2="${n + t}" y2="${t}" stroke="${i}" />
|
|
@@ -437,7 +437,7 @@ class ri {
|
|
|
437
437
|
</svg>
|
|
438
438
|
`;
|
|
439
439
|
return this.encodeSvgToCursor(
|
|
440
|
-
|
|
440
|
+
r,
|
|
441
441
|
n + t,
|
|
442
442
|
n + t
|
|
443
443
|
);
|
|
@@ -701,11 +701,11 @@ class li extends Oe {
|
|
|
701
701
|
const s = new S(
|
|
702
702
|
Math.min(this.mouseDownPositionX, i.x),
|
|
703
703
|
Math.min(this.mouseDownPositionY, i.y)
|
|
704
|
-
),
|
|
704
|
+
), r = new S(
|
|
705
705
|
Math.max(this.mouseDownPositionX, i.x),
|
|
706
706
|
Math.max(this.mouseDownPositionY, i.y)
|
|
707
707
|
);
|
|
708
|
-
this.drawRect(s,
|
|
708
|
+
this.drawRect(s, r);
|
|
709
709
|
}
|
|
710
710
|
}, this.mouseup = (t) => {
|
|
711
711
|
if (this.mouseDown && this.mouseMove) {
|
|
@@ -715,8 +715,8 @@ class li extends Oe {
|
|
|
715
715
|
), s = new S(
|
|
716
716
|
Math.max(this.mouseDownPositionX, i.x),
|
|
717
717
|
Math.max(this.mouseDownPositionY, i.y)
|
|
718
|
-
),
|
|
719
|
-
this.resolve(this.toWcs(
|
|
718
|
+
), r = new L(n, s);
|
|
719
|
+
this.resolve(this.toWcs(r));
|
|
720
720
|
}
|
|
721
721
|
this.mouseDown = !1, this.mouseMove = !1, this.mouseDownPositionX = -1, this.mouseDownPositionY = -1;
|
|
722
722
|
}, this.container = e.canvas, this.color = ci;
|
|
@@ -1238,14 +1238,14 @@ class pi {
|
|
|
1238
1238
|
let n = !0;
|
|
1239
1239
|
this._fileName = e;
|
|
1240
1240
|
try {
|
|
1241
|
-
const
|
|
1241
|
+
const r = (s = e.split(".").pop()) == null ? void 0 : s.toLocaleLowerCase();
|
|
1242
1242
|
await this._database.read(
|
|
1243
1243
|
t,
|
|
1244
1244
|
i,
|
|
1245
|
-
|
|
1245
|
+
r == "dwg" ? ve.DWG : ve.DXF
|
|
1246
1246
|
), this.docTitle = this._fileName;
|
|
1247
|
-
} catch (
|
|
1248
|
-
n = !1, V.emit("failed-to-open-file", { fileName: e }), console.error(
|
|
1247
|
+
} catch (r) {
|
|
1248
|
+
n = !1, V.emit("failed-to-open-file", { fileName: e }), console.error(r);
|
|
1249
1249
|
}
|
|
1250
1250
|
return n;
|
|
1251
1251
|
}
|
|
@@ -1423,9 +1423,9 @@ class fi extends Me {
|
|
|
1423
1423
|
else {
|
|
1424
1424
|
const i = e.startPoint, n = e.endPoint, s = re.radToDeg(
|
|
1425
1425
|
e.majorAxis.angleTo(be.X_AXIS)
|
|
1426
|
-
),
|
|
1426
|
+
), r = e.clockwise ? 0 : 1;
|
|
1427
1427
|
this.svg = `
|
|
1428
|
-
<path d="M${i.x},${i.y} A${e.majorAxisRadius},${e.minorAxisRadius} ${s} ${e.isLargeArc},${
|
|
1428
|
+
<path d="M${i.x},${i.y} A${e.majorAxisRadius},${e.minorAxisRadius} ${s} ${e.isLargeArc},${r} ${n.x},${n.y}"/>`;
|
|
1429
1429
|
}
|
|
1430
1430
|
const t = e.box;
|
|
1431
1431
|
this._box.min.copy(t.min), this._box.max.copy(t.max);
|
|
@@ -1708,14 +1708,14 @@ class yt extends Li {
|
|
|
1708
1708
|
super(), this.epsilon = e;
|
|
1709
1709
|
}
|
|
1710
1710
|
pointAboveOrOnLine(e, t, i) {
|
|
1711
|
-
const n = t[0], s = t[1],
|
|
1712
|
-
return (
|
|
1711
|
+
const n = t[0], s = t[1], r = i[0], o = i[1], a = e[0], h = e[1];
|
|
1712
|
+
return (r - n) * (h - s) - (o - s) * (a - n) >= -this.epsilon;
|
|
1713
1713
|
}
|
|
1714
1714
|
pointBetween(e, t, i) {
|
|
1715
|
-
const n = e[1] - t[1], s = i[0] - t[0],
|
|
1715
|
+
const n = e[1] - t[1], s = i[0] - t[0], r = e[0] - t[0], o = i[1] - t[1], a = r * s + n * o;
|
|
1716
1716
|
if (a < this.epsilon)
|
|
1717
1717
|
return !1;
|
|
1718
|
-
const h = s * s +
|
|
1718
|
+
const h = s * s + o * o;
|
|
1719
1719
|
return !(a - h > -this.epsilon);
|
|
1720
1720
|
}
|
|
1721
1721
|
pointsSameX(e, t) {
|
|
@@ -1725,14 +1725,14 @@ class yt extends Li {
|
|
|
1725
1725
|
return Math.abs(e[1] - t[1]) < this.epsilon;
|
|
1726
1726
|
}
|
|
1727
1727
|
pointsCollinear(e, t, i) {
|
|
1728
|
-
const n = e[0] - t[0], s = e[1] - t[1],
|
|
1729
|
-
return Math.abs(n *
|
|
1728
|
+
const n = e[0] - t[0], s = e[1] - t[1], r = t[0] - i[0], o = t[1] - i[1];
|
|
1729
|
+
return Math.abs(n * o - r * s) < this.epsilon;
|
|
1730
1730
|
}
|
|
1731
1731
|
linesIntersect(e, t, i, n) {
|
|
1732
|
-
const s = t[0] - e[0],
|
|
1732
|
+
const s = t[0] - e[0], r = t[1] - e[1], o = n[0] - i[0], a = n[1] - i[1], h = s * a - r * o;
|
|
1733
1733
|
if (Math.abs(h) < this.epsilon)
|
|
1734
1734
|
return null;
|
|
1735
|
-
const l = e[0] - i[0], m = e[1] - i[1], u = (
|
|
1735
|
+
const l = e[0] - i[0], m = e[1] - i[1], u = (o * m - a * l) / h, p = (s * m - r * l) / h, g = (f) => f <= -this.epsilon ? B.BeforeStart : f < this.epsilon ? B.EqualStart : f - 1 <= -this.epsilon ? B.BetweenStartAndEnd : f - 1 < this.epsilon ? B.EqualEnd : B.AfterEnd, y = [e[0] + u * s, e[1] + u * r];
|
|
1736
1736
|
return {
|
|
1737
1737
|
alongA: g(u),
|
|
1738
1738
|
alongB: g(p),
|
|
@@ -1766,15 +1766,15 @@ class Ue {
|
|
|
1766
1766
|
findTransition(e, t) {
|
|
1767
1767
|
var i, n;
|
|
1768
1768
|
const s = (a, h) => t(h) - t(a);
|
|
1769
|
-
let
|
|
1770
|
-
for (;
|
|
1771
|
-
const a =
|
|
1772
|
-
s(this.nodes[a], e) > 0 ?
|
|
1769
|
+
let r = 0, o = this.nodes.length;
|
|
1770
|
+
for (; r < o; ) {
|
|
1771
|
+
const a = r + o >> 1;
|
|
1772
|
+
s(this.nodes[a], e) > 0 ? o = a : r = a + 1;
|
|
1773
1773
|
}
|
|
1774
1774
|
return {
|
|
1775
|
-
before:
|
|
1776
|
-
after: (n = this.nodes[
|
|
1777
|
-
insert: (a) => (this.nodes.splice(
|
|
1775
|
+
before: r <= 0 ? null : (i = this.nodes[r - 1]) !== null && i !== void 0 ? i : null,
|
|
1776
|
+
after: (n = this.nodes[r]) !== null && n !== void 0 ? n : null,
|
|
1777
|
+
insert: (a) => (this.nodes.splice(r, 0, a), a)
|
|
1778
1778
|
};
|
|
1779
1779
|
}
|
|
1780
1780
|
}
|
|
@@ -1796,13 +1796,13 @@ class Xe {
|
|
|
1796
1796
|
constructor(e, t, i = null) {
|
|
1797
1797
|
this.events = new Ue(), this.status = new Ue(), this.selfIntersection = e, this.geo = t, this.log = i;
|
|
1798
1798
|
}
|
|
1799
|
-
compareEvents(e, t, i, n, s,
|
|
1800
|
-
const
|
|
1801
|
-
return
|
|
1799
|
+
compareEvents(e, t, i, n, s, r) {
|
|
1800
|
+
const o = this.geo.pointsCompare(t, s);
|
|
1801
|
+
return o !== 0 ? o : this.geo.pointsSame(i, r) ? 0 : e !== n ? e ? 1 : -1 : this.geo.pointAboveOrOnLine(
|
|
1802
1802
|
i,
|
|
1803
|
-
n ? s :
|
|
1803
|
+
n ? s : r,
|
|
1804
1804
|
// order matters
|
|
1805
|
-
n ?
|
|
1805
|
+
n ? r : s
|
|
1806
1806
|
) ? 1 : -1;
|
|
1807
1807
|
}
|
|
1808
1808
|
addEvent(e) {
|
|
@@ -1830,33 +1830,33 @@ class Xe {
|
|
|
1830
1830
|
}
|
|
1831
1831
|
}
|
|
1832
1832
|
compareStatus(e, t) {
|
|
1833
|
-
const i = e.seg.start, n = e.seg.end, s = t.seg.start,
|
|
1834
|
-
return this.geo.pointsCollinear(i, s,
|
|
1833
|
+
const i = e.seg.start, n = e.seg.end, s = t.seg.start, r = t.seg.end;
|
|
1834
|
+
return this.geo.pointsCollinear(i, s, r) ? this.geo.pointsCollinear(n, s, r) || this.geo.pointAboveOrOnLine(n, s, r) ? 1 : -1 : this.geo.pointAboveOrOnLine(i, s, r) ? 1 : -1;
|
|
1835
1835
|
}
|
|
1836
1836
|
statusFindSurrounding(e) {
|
|
1837
1837
|
return this.status.findTransition(e, (t) => t === e ? 0 : -this.compareStatus(e, t));
|
|
1838
1838
|
}
|
|
1839
1839
|
checkIntersection(e, t) {
|
|
1840
1840
|
var i;
|
|
1841
|
-
const n = e.seg, s = t.seg,
|
|
1841
|
+
const n = e.seg, s = t.seg, r = n.start, o = n.end, a = s.start, h = s.end;
|
|
1842
1842
|
(i = this.log) === null || i === void 0 || i.checkIntersection(n, s);
|
|
1843
|
-
const l = this.geo.linesIntersect(
|
|
1843
|
+
const l = this.geo.linesIntersect(r, o, a, h);
|
|
1844
1844
|
if (l === null) {
|
|
1845
|
-
if (!this.geo.pointsCollinear(
|
|
1845
|
+
if (!this.geo.pointsCollinear(r, o, a) || this.geo.pointsSame(r, h) || this.geo.pointsSame(o, a))
|
|
1846
1846
|
return null;
|
|
1847
|
-
const m = this.geo.pointsSame(
|
|
1847
|
+
const m = this.geo.pointsSame(r, a), u = this.geo.pointsSame(o, h);
|
|
1848
1848
|
if (m && u)
|
|
1849
1849
|
return t;
|
|
1850
|
-
const p = !m && this.geo.pointBetween(
|
|
1850
|
+
const p = !m && this.geo.pointBetween(r, a, h), g = !u && this.geo.pointBetween(o, a, h);
|
|
1851
1851
|
if (m)
|
|
1852
|
-
return g ? this.divideEvent(t,
|
|
1853
|
-
p && (u || (g ? this.divideEvent(t,
|
|
1852
|
+
return g ? this.divideEvent(t, o) : this.divideEvent(e, h), t;
|
|
1853
|
+
p && (u || (g ? this.divideEvent(t, o) : this.divideEvent(e, h)), this.divideEvent(t, r));
|
|
1854
1854
|
} else
|
|
1855
|
-
l.alongA === B.BetweenStartAndEnd && (l.alongB === B.EqualStart ? this.divideEvent(e, a) : l.alongB === B.BetweenStartAndEnd ? this.divideEvent(e, l.p) : l.alongB === B.EqualEnd && this.divideEvent(e, h)), l.alongB === B.BetweenStartAndEnd && (l.alongA === B.EqualStart ? this.divideEvent(t,
|
|
1855
|
+
l.alongA === B.BetweenStartAndEnd && (l.alongB === B.EqualStart ? this.divideEvent(e, a) : l.alongB === B.BetweenStartAndEnd ? this.divideEvent(e, l.p) : l.alongB === B.EqualEnd && this.divideEvent(e, h)), l.alongB === B.BetweenStartAndEnd && (l.alongA === B.EqualStart ? this.divideEvent(t, r) : l.alongA === B.BetweenStartAndEnd ? this.divideEvent(t, l.p) : l.alongA === B.EqualEnd && this.divideEvent(t, o));
|
|
1856
1856
|
return null;
|
|
1857
1857
|
}
|
|
1858
1858
|
calculate(e, t) {
|
|
1859
|
-
var i, n, s,
|
|
1859
|
+
var i, n, s, r, o, a, h, l;
|
|
1860
1860
|
const m = [];
|
|
1861
1861
|
for (; !this.events.isEmpty(); ) {
|
|
1862
1862
|
const u = this.events.getHead();
|
|
@@ -1878,10 +1878,10 @@ class Xe {
|
|
|
1878
1878
|
u.seg.myFill.below === null ? x = !0 : x = u.seg.myFill.above !== u.seg.myFill.below, x && (_.seg.myFill.above = !_.seg.myFill.above);
|
|
1879
1879
|
} else
|
|
1880
1880
|
_.seg.otherFill = u.seg.myFill;
|
|
1881
|
-
(
|
|
1881
|
+
(r = this.log) === null || r === void 0 || r.segmentUpdate(_.seg), this.events.remove(u.other), this.events.remove(u);
|
|
1882
1882
|
}
|
|
1883
1883
|
if (this.events.getHead() !== u) {
|
|
1884
|
-
(
|
|
1884
|
+
(o = this.log) === null || o === void 0 || o.rewind(u.seg);
|
|
1885
1885
|
continue;
|
|
1886
1886
|
}
|
|
1887
1887
|
if (this.selfIntersection) {
|
|
@@ -1930,8 +1930,8 @@ function te(c, e, t) {
|
|
|
1930
1930
|
for (const n of c) {
|
|
1931
1931
|
const s = (n.myFill.above ? 8 : 0) + (n.myFill.below ? 4 : 0) + (n.otherFill && n.otherFill.above ? 2 : 0) + (n.otherFill && n.otherFill.below ? 1 : 0);
|
|
1932
1932
|
if (e[s] !== 0) {
|
|
1933
|
-
const
|
|
1934
|
-
|
|
1933
|
+
const r = new Z(n.start, n.end, null, t);
|
|
1934
|
+
r.myFill.above = e[s] === 1, r.myFill.below = e[s] === 2, i.push(r);
|
|
1935
1935
|
}
|
|
1936
1936
|
}
|
|
1937
1937
|
return t == null || t.selected(i), i;
|
|
@@ -1966,8 +1966,8 @@ function Ei(c, e, t) {
|
|
|
1966
1966
|
const P = w[w.length - 2], v = b[0], G = b[1];
|
|
1967
1967
|
e.pointsCollinear(P, I, v) && (t == null || t.chainRemoveTail(_, I), w.pop(), I = P), e.pointsCollinear(I, v, G) && (t == null || t.chainRemoveHead(x, v), b.shift()), t == null || t.chainJoin(_, x), i[_] = w.concat(b), i.splice(x, 1);
|
|
1968
1968
|
};
|
|
1969
|
-
const
|
|
1970
|
-
if (e.pointsSame(
|
|
1969
|
+
const r = s.start, o = s.end;
|
|
1970
|
+
if (e.pointsSame(r, o)) {
|
|
1971
1971
|
console.warn("PolyBool: Warning: Zero-length segment detected; your epsilon is probably too small or too large");
|
|
1972
1972
|
continue;
|
|
1973
1973
|
}
|
|
@@ -1984,25 +1984,25 @@ function Ei(c, e, t) {
|
|
|
1984
1984
|
let l = a;
|
|
1985
1985
|
for (let _ = 0; _ < i.length; _++) {
|
|
1986
1986
|
const x = i[_], w = x[0], b = x[x.length - 1];
|
|
1987
|
-
if (e.pointsSame(w,
|
|
1987
|
+
if (e.pointsSame(w, r)) {
|
|
1988
1988
|
if (m(_, !0, !0))
|
|
1989
1989
|
break;
|
|
1990
|
-
} else if (e.pointsSame(w,
|
|
1990
|
+
} else if (e.pointsSame(w, o)) {
|
|
1991
1991
|
if (m(_, !0, !1))
|
|
1992
1992
|
break;
|
|
1993
|
-
} else if (e.pointsSame(b,
|
|
1993
|
+
} else if (e.pointsSame(b, r)) {
|
|
1994
1994
|
if (m(_, !1, !0))
|
|
1995
1995
|
break;
|
|
1996
|
-
} else if (e.pointsSame(b,
|
|
1996
|
+
} else if (e.pointsSame(b, o) && m(_, !1, !1))
|
|
1997
1997
|
break;
|
|
1998
1998
|
}
|
|
1999
1999
|
if (l === a) {
|
|
2000
|
-
i.push([
|
|
2000
|
+
i.push([r, o]), t == null || t.chainNew(r, o);
|
|
2001
2001
|
continue;
|
|
2002
2002
|
}
|
|
2003
2003
|
if (l === h) {
|
|
2004
2004
|
t == null || t.chainMatch(a.index);
|
|
2005
|
-
const _ = a.index, x = a.matches_pt1 ?
|
|
2005
|
+
const _ = a.index, x = a.matches_pt1 ? o : r, w = a.matches_head, b = i[_];
|
|
2006
2006
|
let I = w ? b[0] : b[b.length - 1];
|
|
2007
2007
|
const P = w ? b[1] : b[b.length - 2], v = w ? b[b.length - 1] : b[0], G = w ? b[b.length - 2] : b[1];
|
|
2008
2008
|
if (e.pointsCollinear(P, I, x) && (w ? (t == null || t.chainRemoveHead(a.index, x), b.shift()) : (t == null || t.chainRemoveTail(a.index, x), b.pop()), I = P), e.pointsSame(v, x)) {
|
|
@@ -2166,24 +2166,24 @@ class ft {
|
|
|
2166
2166
|
}
|
|
2167
2167
|
// helper functions for common operations
|
|
2168
2168
|
union(e, t) {
|
|
2169
|
-
const i = this.segments(e), n = this.segments(t), s = this.combine(i, n),
|
|
2170
|
-
return this.polygon(
|
|
2169
|
+
const i = this.segments(e), n = this.segments(t), s = this.combine(i, n), r = this.selectUnion(s);
|
|
2170
|
+
return this.polygon(r);
|
|
2171
2171
|
}
|
|
2172
2172
|
intersect(e, t) {
|
|
2173
|
-
const i = this.segments(e), n = this.segments(t), s = this.combine(i, n),
|
|
2174
|
-
return this.polygon(
|
|
2173
|
+
const i = this.segments(e), n = this.segments(t), s = this.combine(i, n), r = this.selectIntersect(s);
|
|
2174
|
+
return this.polygon(r);
|
|
2175
2175
|
}
|
|
2176
2176
|
difference(e, t) {
|
|
2177
|
-
const i = this.segments(e), n = this.segments(t), s = this.combine(i, n),
|
|
2178
|
-
return this.polygon(
|
|
2177
|
+
const i = this.segments(e), n = this.segments(t), s = this.combine(i, n), r = this.selectDifference(s);
|
|
2178
|
+
return this.polygon(r);
|
|
2179
2179
|
}
|
|
2180
2180
|
differenceRev(e, t) {
|
|
2181
|
-
const i = this.segments(e), n = this.segments(t), s = this.combine(i, n),
|
|
2182
|
-
return this.polygon(
|
|
2181
|
+
const i = this.segments(e), n = this.segments(t), s = this.combine(i, n), r = this.selectDifferenceRev(s);
|
|
2182
|
+
return this.polygon(r);
|
|
2183
2183
|
}
|
|
2184
2184
|
xor(e, t) {
|
|
2185
|
-
const i = this.segments(e), n = this.segments(t), s = this.combine(i, n),
|
|
2186
|
-
return this.polygon(
|
|
2185
|
+
const i = this.segments(e), n = this.segments(t), s = this.combine(i, n), r = this.selectXor(s);
|
|
2186
|
+
return this.polygon(r);
|
|
2187
2187
|
}
|
|
2188
2188
|
}
|
|
2189
2189
|
new ft(new yt());
|
|
@@ -2199,10 +2199,10 @@ class Se extends d.Object3D {
|
|
|
2199
2199
|
function i(s) {
|
|
2200
2200
|
s.position.set(0, 0, 0), s.rotation.set(0, 0, 0), s.scale.set(1, 1, 1), s.matrix.identity();
|
|
2201
2201
|
}
|
|
2202
|
-
function n(s,
|
|
2203
|
-
const
|
|
2204
|
-
for (const a of
|
|
2205
|
-
a.applyMatrix4(
|
|
2202
|
+
function n(s, r) {
|
|
2203
|
+
const o = [...s.children];
|
|
2204
|
+
for (const a of o)
|
|
2205
|
+
a.applyMatrix4(r), i(a), a.children.length > 0 ? n(a, a.matrixWorld) : t.push(a);
|
|
2206
2206
|
s.children = [];
|
|
2207
2207
|
}
|
|
2208
2208
|
e.updateMatrixWorld(!0), n(e, e.matrixWorld);
|
|
@@ -2217,8 +2217,8 @@ class Se extends d.Object3D {
|
|
|
2217
2217
|
*/
|
|
2218
2218
|
static disposeObject(e, t = !0) {
|
|
2219
2219
|
t && e.removeFromParent(), (e instanceof d.Mesh || e instanceof d.Line || e instanceof d.Points) && e.geometry && e.geometry.dispose(), (e instanceof d.Mesh || e instanceof d.Line || e instanceof d.Points) && (Array.isArray(e.material) ? e.material : [e.material]).forEach((i) => {
|
|
2220
|
-
var n, s,
|
|
2221
|
-
i.dispose(), (n = i.map) == null || n.dispose(), (s = i.envMap) == null || s.dispose(), (
|
|
2220
|
+
var n, s, r, o, a, h, l, m;
|
|
2221
|
+
i.dispose(), (n = i.map) == null || n.dispose(), (s = i.envMap) == null || s.dispose(), (r = i.lightMap) == null || r.dispose(), (o = i.bumpMap) == null || o.dispose(), (a = i.normalMap) == null || a.dispose(), (h = i.roughnessMap) == null || h.dispose(), (l = i.metalnessMap) == null || l.dispose(), (m = i.alphaMap) == null || m.dispose();
|
|
2222
2222
|
}), e.children.forEach((i) => this.disposeObject(i)), "geometry" in e && (e.geometry = null), "material" in e && (e.material = null), e.children = [];
|
|
2223
2223
|
}
|
|
2224
2224
|
/**
|
|
@@ -2901,12 +2901,12 @@ class ue {
|
|
|
2901
2901
|
if (s === "string") return n.length * 2;
|
|
2902
2902
|
if (s === "symbol" || s === "function" || t.has(n)) return 0;
|
|
2903
2903
|
if (t.add(n), Array.isArray(n))
|
|
2904
|
-
return n.map(i).reduce((
|
|
2904
|
+
return n.map(i).reduce((r, o) => r + o, 0);
|
|
2905
2905
|
if (s === "object") {
|
|
2906
|
-
let
|
|
2907
|
-
for (const
|
|
2908
|
-
Object.prototype.hasOwnProperty.call(n,
|
|
2909
|
-
return
|
|
2906
|
+
let r = 0;
|
|
2907
|
+
for (const o in n)
|
|
2908
|
+
Object.prototype.hasOwnProperty.call(n, o) && (r += o.length * 2, r += i(n[o]));
|
|
2909
|
+
return r;
|
|
2910
2910
|
}
|
|
2911
2911
|
return 0;
|
|
2912
2912
|
}
|
|
@@ -2932,8 +2932,8 @@ function je(c, e, t = 0) {
|
|
|
2932
2932
|
if (c.isInterleavedBufferAttribute || c.array.constructor !== e.array.constructor) {
|
|
2933
2933
|
const n = c.count;
|
|
2934
2934
|
for (let s = 0; s < n; s++)
|
|
2935
|
-
for (let
|
|
2936
|
-
e.setComponent(s + t,
|
|
2935
|
+
for (let r = 0; r < i; r++)
|
|
2936
|
+
e.setComponent(s + t, r, c.getComponent(s, r));
|
|
2937
2937
|
} else
|
|
2938
2938
|
e.array.set(c.array, t * i);
|
|
2939
2939
|
e.needsUpdate = !0;
|
|
@@ -2974,7 +2974,7 @@ class Pi extends d.LineSegments {
|
|
|
2974
2974
|
const t = this.geometry, i = this._maxVertexCount, n = this._maxIndexCount;
|
|
2975
2975
|
if (this._geometryInitialized === !1) {
|
|
2976
2976
|
for (const s in e.attributes) {
|
|
2977
|
-
const
|
|
2977
|
+
const r = e.getAttribute(s), { array: o, itemSize: a, normalized: h } = r, l = new o.constructor(i * a), m = new d.BufferAttribute(
|
|
2978
2978
|
l,
|
|
2979
2979
|
a,
|
|
2980
2980
|
h
|
|
@@ -3012,8 +3012,8 @@ class Pi extends d.LineSegments {
|
|
|
3012
3012
|
let n = this._maxIndexCount;
|
|
3013
3013
|
i && this.unusedIndexCount < t.count && (n = (this._maxIndexCount + t.count) * 1.5);
|
|
3014
3014
|
const s = e.getAttribute("position");
|
|
3015
|
-
let
|
|
3016
|
-
s && this.unusedVertexCount < s.count && (
|
|
3015
|
+
let r = this._maxVertexCount;
|
|
3016
|
+
s && this.unusedVertexCount < s.count && (r = (this._maxVertexCount + s.count) * 1.5), (n > this._maxIndexCount || r > this._maxVertexCount) && this.setGeometrySize(r, n);
|
|
3017
3017
|
}
|
|
3018
3018
|
validateGeometryId(e) {
|
|
3019
3019
|
const t = this._geometryInfo;
|
|
@@ -3043,8 +3043,8 @@ class Pi extends d.LineSegments {
|
|
|
3043
3043
|
if (n.position) {
|
|
3044
3044
|
const s = i.create(e, n.position);
|
|
3045
3045
|
if (s.line) {
|
|
3046
|
-
const
|
|
3047
|
-
this.setGeometryInfo(
|
|
3046
|
+
const r = this.addGeometry(s.line);
|
|
3047
|
+
this.setGeometryInfo(r, n);
|
|
3048
3048
|
}
|
|
3049
3049
|
}
|
|
3050
3050
|
});
|
|
@@ -3087,13 +3087,13 @@ class Pi extends d.LineSegments {
|
|
|
3087
3087
|
visible: !0
|
|
3088
3088
|
}, s = this._geometryInfo;
|
|
3089
3089
|
n.vertexStart = this._nextVertexStart, n.reservedVertexCount = t === -1 ? e.getAttribute("position").count : t;
|
|
3090
|
-
const
|
|
3091
|
-
if (
|
|
3090
|
+
const r = e.getIndex();
|
|
3091
|
+
if (r !== null && (n.indexStart = this._nextIndexStart, n.reservedIndexCount = i === -1 ? r.count : i), n.indexStart !== -1 && n.indexStart + n.reservedIndexCount > this._maxIndexCount || n.vertexStart + n.reservedVertexCount > this._maxVertexCount)
|
|
3092
3092
|
throw new Error(
|
|
3093
3093
|
"AcTrBatchedLine: Reserved space request exceeds the maximum buffer size."
|
|
3094
3094
|
);
|
|
3095
|
-
let
|
|
3096
|
-
return this._availableGeometryIds.length > 0 ? (this._availableGeometryIds.sort(Ve),
|
|
3095
|
+
let o;
|
|
3096
|
+
return this._availableGeometryIds.length > 0 ? (this._availableGeometryIds.sort(Ve), o = this._availableGeometryIds.shift(), s[o] = n) : (o = this._geometryCount, this._geometryCount++, s.push(n)), this.setGeometryAt(o, e), this._nextIndexStart = n.indexStart + n.reservedIndexCount, this._nextVertexStart = n.vertexStart + n.reservedVertexCount, o;
|
|
3097
3097
|
}
|
|
3098
3098
|
setGeometryInfo(e, t) {
|
|
3099
3099
|
if (e >= this._geometryCount)
|
|
@@ -3105,13 +3105,13 @@ class Pi extends d.LineSegments {
|
|
|
3105
3105
|
if (e >= this._geometryCount)
|
|
3106
3106
|
throw new Error("AcTrBatchedLine: Maximum geometry count reached.");
|
|
3107
3107
|
this._validateGeometry(t);
|
|
3108
|
-
const i = this.geometry, n = i.getIndex() !== null, s = i.getIndex(),
|
|
3109
|
-
if (n &&
|
|
3108
|
+
const i = this.geometry, n = i.getIndex() !== null, s = i.getIndex(), r = t.getIndex(), o = this._geometryInfo[e];
|
|
3109
|
+
if (n && r.count > o.reservedIndexCount || t.attributes.position.count > o.reservedVertexCount)
|
|
3110
3110
|
throw new Error(
|
|
3111
3111
|
"AcTrBatchedLine: Reserved space not large enough for provided geometry."
|
|
3112
3112
|
);
|
|
3113
|
-
const a =
|
|
3114
|
-
|
|
3113
|
+
const a = o.vertexStart, h = o.reservedVertexCount;
|
|
3114
|
+
o.vertexCount = t.getAttribute("position").count;
|
|
3115
3115
|
for (const l in i.attributes) {
|
|
3116
3116
|
const m = t.getAttribute(l), u = i.getAttribute(
|
|
3117
3117
|
l
|
|
@@ -3129,15 +3129,15 @@ class Pi extends d.LineSegments {
|
|
|
3129
3129
|
);
|
|
3130
3130
|
}
|
|
3131
3131
|
if (n && s) {
|
|
3132
|
-
const l =
|
|
3133
|
-
|
|
3134
|
-
for (let u = 0; u <
|
|
3135
|
-
s.setX(l + u, a +
|
|
3136
|
-
for (let u =
|
|
3132
|
+
const l = o.indexStart, m = o.reservedIndexCount;
|
|
3133
|
+
o.indexCount = t.getIndex().count;
|
|
3134
|
+
for (let u = 0; u < r.count; u++)
|
|
3135
|
+
s.setX(l + u, a + r.getX(u));
|
|
3136
|
+
for (let u = r.count, p = m; u < p; u++)
|
|
3137
3137
|
s.setX(l + u, a);
|
|
3138
|
-
s.needsUpdate = !0, s.addUpdateRange(l,
|
|
3138
|
+
s.needsUpdate = !0, s.addUpdateRange(l, o.reservedIndexCount);
|
|
3139
3139
|
}
|
|
3140
|
-
return
|
|
3140
|
+
return o.start = n ? o.indexStart : o.vertexStart, o.count = n ? o.indexCount : o.vertexCount, o.boundingBox = null, t.boundingBox !== null && (o.boundingBox = t.boundingBox.clone()), o.boundingSphere = null, t.boundingSphere !== null && (o.boundingSphere = t.boundingSphere.clone()), e;
|
|
3141
3141
|
}
|
|
3142
3142
|
deleteGeometry(e) {
|
|
3143
3143
|
const t = this._geometryInfo;
|
|
@@ -3145,9 +3145,9 @@ class Pi extends d.LineSegments {
|
|
|
3145
3145
|
}
|
|
3146
3146
|
optimize() {
|
|
3147
3147
|
let e = 0, t = 0;
|
|
3148
|
-
const i = this._geometryInfo, n = i.map((
|
|
3149
|
-
for (let
|
|
3150
|
-
const a = n[
|
|
3148
|
+
const i = this._geometryInfo, n = i.map((r, o) => o).sort((r, o) => i[r].vertexStart - i[o].vertexStart), s = this.geometry;
|
|
3149
|
+
for (let r = 0, o = i.length; r < o; r++) {
|
|
3150
|
+
const a = n[r], h = i[a];
|
|
3151
3151
|
if (h.active !== !1) {
|
|
3152
3152
|
if (s.index !== null) {
|
|
3153
3153
|
if (h.indexStart !== t) {
|
|
@@ -3188,10 +3188,10 @@ class Pi extends d.LineSegments {
|
|
|
3188
3188
|
return null;
|
|
3189
3189
|
const i = this.geometry, n = this._geometryInfo[e];
|
|
3190
3190
|
if (n.boundingBox === null) {
|
|
3191
|
-
const s = new d.Box3(),
|
|
3191
|
+
const s = new d.Box3(), r = i.index, o = i.attributes.position;
|
|
3192
3192
|
for (let a = n.start, h = n.start + n.count; a < h; a++) {
|
|
3193
3193
|
let l = a;
|
|
3194
|
-
|
|
3194
|
+
r && (l = r.getX(l)), s.expandByPoint(F.fromBufferAttribute(o, l));
|
|
3195
3195
|
}
|
|
3196
3196
|
n.boundingBox = s;
|
|
3197
3197
|
}
|
|
@@ -3205,11 +3205,11 @@ class Pi extends d.LineSegments {
|
|
|
3205
3205
|
if (n.boundingSphere === null) {
|
|
3206
3206
|
const s = new d.Sphere();
|
|
3207
3207
|
this.getBoundingBoxAt(e, Ye), Ye.getCenter(s.center);
|
|
3208
|
-
const
|
|
3208
|
+
const r = i.index, o = i.attributes.position;
|
|
3209
3209
|
let a = 0;
|
|
3210
3210
|
for (let h = n.start, l = n.start + n.count; h < l; h++) {
|
|
3211
3211
|
let m = h;
|
|
3212
|
-
|
|
3212
|
+
r && (m = r.getX(m)), F.fromBufferAttribute(o, m), a = Math.max(
|
|
3213
3213
|
a,
|
|
3214
3214
|
s.center.distanceToSquared(F)
|
|
3215
3215
|
);
|
|
@@ -3268,9 +3268,9 @@ class Pi extends d.LineSegments {
|
|
|
3268
3268
|
if (n.bboxIntersectionCheck) {
|
|
3269
3269
|
const s = n.boundingBox;
|
|
3270
3270
|
if (t.ray.intersectBox(s, F)) {
|
|
3271
|
-
const
|
|
3271
|
+
const r = t.ray.origin.distanceTo(F);
|
|
3272
3272
|
i.push({
|
|
3273
|
-
distance:
|
|
3273
|
+
distance: r,
|
|
3274
3274
|
point: F.clone(),
|
|
3275
3275
|
object: this,
|
|
3276
3276
|
face: null,
|
|
@@ -3288,9 +3288,9 @@ class Pi extends d.LineSegments {
|
|
|
3288
3288
|
n.start,
|
|
3289
3289
|
n.count
|
|
3290
3290
|
), N.raycast(t, me);
|
|
3291
|
-
for (let s = 0,
|
|
3292
|
-
const
|
|
3293
|
-
|
|
3291
|
+
for (let s = 0, r = me.length; s < r; s++) {
|
|
3292
|
+
const o = me[s];
|
|
3293
|
+
o.object = this, o.batchId = e, o.objectId = n.objectId, i.push(o);
|
|
3294
3294
|
}
|
|
3295
3295
|
me.length = 0;
|
|
3296
3296
|
}
|
|
@@ -3336,7 +3336,7 @@ class Ri extends d.Mesh {
|
|
|
3336
3336
|
const t = this.geometry, i = this._maxVertexCount, n = this._maxIndexCount;
|
|
3337
3337
|
if (this._geometryInitialized === !1) {
|
|
3338
3338
|
for (const s in e.attributes) {
|
|
3339
|
-
const
|
|
3339
|
+
const r = e.getAttribute(s), { array: o, itemSize: a, normalized: h } = r, l = new o.constructor(i * a), m = new d.BufferAttribute(
|
|
3340
3340
|
l,
|
|
3341
3341
|
a,
|
|
3342
3342
|
h
|
|
@@ -3374,8 +3374,8 @@ class Ri extends d.Mesh {
|
|
|
3374
3374
|
let n = this._maxIndexCount;
|
|
3375
3375
|
i && this.unusedIndexCount < t.count && (n = (this._maxIndexCount + t.count) * 1.5);
|
|
3376
3376
|
const s = e.getAttribute("position");
|
|
3377
|
-
let
|
|
3378
|
-
s && this.unusedVertexCount < s.count && (
|
|
3377
|
+
let r = this._maxVertexCount;
|
|
3378
|
+
s && this.unusedVertexCount < s.count && (r = (this._maxVertexCount + s.count) * 1.5), (n > this._maxIndexCount || r > this._maxVertexCount) && this.setGeometrySize(r, n);
|
|
3379
3379
|
}
|
|
3380
3380
|
validateGeometryId(e) {
|
|
3381
3381
|
const t = this._geometryInfo;
|
|
@@ -3422,13 +3422,13 @@ class Ri extends d.Mesh {
|
|
|
3422
3422
|
visible: !0
|
|
3423
3423
|
}, s = this._geometryInfo;
|
|
3424
3424
|
n.vertexStart = this._nextVertexStart, n.reservedVertexCount = t === -1 ? e.getAttribute("position").count : t;
|
|
3425
|
-
const
|
|
3426
|
-
if (
|
|
3425
|
+
const r = e.getIndex();
|
|
3426
|
+
if (r !== null && (n.indexStart = this._nextIndexStart, n.reservedIndexCount = i === -1 ? r.count : i), n.indexStart !== -1 && n.indexStart + n.reservedIndexCount > this._maxIndexCount || n.vertexStart + n.reservedVertexCount > this._maxVertexCount)
|
|
3427
3427
|
throw new Error(
|
|
3428
3428
|
"AcTrBatchedMesh: Reserved space request exceeds the maximum buffer size."
|
|
3429
3429
|
);
|
|
3430
|
-
let
|
|
3431
|
-
return this._availableGeometryIds.length > 0 ? (this._availableGeometryIds.sort(Ve),
|
|
3430
|
+
let o;
|
|
3431
|
+
return this._availableGeometryIds.length > 0 ? (this._availableGeometryIds.sort(Ve), o = this._availableGeometryIds.shift(), s[o] = n) : (o = this._geometryCount, this._geometryCount++, s.push(n)), this.setGeometryAt(o, e), this._nextIndexStart = n.indexStart + n.reservedIndexCount, this._nextVertexStart = n.vertexStart + n.reservedVertexCount, o;
|
|
3432
3432
|
}
|
|
3433
3433
|
setGeometryInfo(e, t) {
|
|
3434
3434
|
if (e >= this._geometryCount)
|
|
@@ -3440,13 +3440,13 @@ class Ri extends d.Mesh {
|
|
|
3440
3440
|
if (e >= this._geometryCount)
|
|
3441
3441
|
throw new Error("AcTrBatchedMesh: Maximum geometry count reached.");
|
|
3442
3442
|
this._validateGeometry(t);
|
|
3443
|
-
const i = this.geometry, n = i.getIndex() !== null, s = i.getIndex(),
|
|
3444
|
-
if (n &&
|
|
3443
|
+
const i = this.geometry, n = i.getIndex() !== null, s = i.getIndex(), r = t.getIndex(), o = this._geometryInfo[e];
|
|
3444
|
+
if (n && r.count > o.reservedIndexCount || t.attributes.position.count > o.reservedVertexCount)
|
|
3445
3445
|
throw new Error(
|
|
3446
3446
|
"AcTrBatchedMesh: Reserved space not large enough for provided geometry."
|
|
3447
3447
|
);
|
|
3448
|
-
const a =
|
|
3449
|
-
|
|
3448
|
+
const a = o.vertexStart, h = o.reservedVertexCount;
|
|
3449
|
+
o.vertexCount = t.getAttribute("position").count;
|
|
3450
3450
|
for (const l in i.attributes) {
|
|
3451
3451
|
const m = t.getAttribute(l), u = i.getAttribute(
|
|
3452
3452
|
l
|
|
@@ -3464,15 +3464,15 @@ class Ri extends d.Mesh {
|
|
|
3464
3464
|
);
|
|
3465
3465
|
}
|
|
3466
3466
|
if (n && s) {
|
|
3467
|
-
const l =
|
|
3468
|
-
|
|
3469
|
-
for (let u = 0; u <
|
|
3470
|
-
s.setX(l + u, a +
|
|
3471
|
-
for (let u =
|
|
3467
|
+
const l = o.indexStart, m = o.reservedIndexCount;
|
|
3468
|
+
o.indexCount = t.getIndex().count;
|
|
3469
|
+
for (let u = 0; u < r.count; u++)
|
|
3470
|
+
s.setX(l + u, a + r.getX(u));
|
|
3471
|
+
for (let u = r.count, p = m; u < p; u++)
|
|
3472
3472
|
s.setX(l + u, a);
|
|
3473
|
-
s.needsUpdate = !0, s.addUpdateRange(l,
|
|
3473
|
+
s.needsUpdate = !0, s.addUpdateRange(l, o.reservedIndexCount);
|
|
3474
3474
|
}
|
|
3475
|
-
return
|
|
3475
|
+
return o.start = n ? o.indexStart : o.vertexStart, o.count = n ? o.indexCount : o.vertexCount, o.boundingBox = null, t.boundingBox !== null && (o.boundingBox = t.boundingBox.clone()), o.boundingSphere = null, t.boundingSphere !== null && (o.boundingSphere = t.boundingSphere.clone()), e;
|
|
3476
3476
|
}
|
|
3477
3477
|
deleteGeometry(e) {
|
|
3478
3478
|
const t = this._geometryInfo;
|
|
@@ -3480,9 +3480,9 @@ class Ri extends d.Mesh {
|
|
|
3480
3480
|
}
|
|
3481
3481
|
optimize() {
|
|
3482
3482
|
let e = 0, t = 0;
|
|
3483
|
-
const i = this._geometryInfo, n = i.map((
|
|
3484
|
-
for (let
|
|
3485
|
-
const a = n[
|
|
3483
|
+
const i = this._geometryInfo, n = i.map((r, o) => o).sort((r, o) => i[r].vertexStart - i[o].vertexStart), s = this.geometry;
|
|
3484
|
+
for (let r = 0, o = i.length; r < o; r++) {
|
|
3485
|
+
const a = n[r], h = i[a];
|
|
3486
3486
|
if (h.active !== !1) {
|
|
3487
3487
|
if (s.index !== null) {
|
|
3488
3488
|
if (h.indexStart !== t) {
|
|
@@ -3523,10 +3523,10 @@ class Ri extends d.Mesh {
|
|
|
3523
3523
|
return null;
|
|
3524
3524
|
const i = this.geometry, n = this._geometryInfo[e];
|
|
3525
3525
|
if (n.boundingBox === null) {
|
|
3526
|
-
const s = new d.Box3(),
|
|
3526
|
+
const s = new d.Box3(), r = i.index, o = i.attributes.position;
|
|
3527
3527
|
for (let a = n.start, h = n.start + n.count; a < h; a++) {
|
|
3528
3528
|
let l = a;
|
|
3529
|
-
|
|
3529
|
+
r && (l = r.getX(l)), s.expandByPoint(U.fromBufferAttribute(o, l));
|
|
3530
3530
|
}
|
|
3531
3531
|
n.boundingBox = s;
|
|
3532
3532
|
}
|
|
@@ -3540,11 +3540,11 @@ class Ri extends d.Mesh {
|
|
|
3540
3540
|
if (n.boundingSphere === null) {
|
|
3541
3541
|
const s = new d.Sphere();
|
|
3542
3542
|
this.getBoundingBoxAt(e, He), He.getCenter(s.center);
|
|
3543
|
-
const
|
|
3543
|
+
const r = i.index, o = i.attributes.position;
|
|
3544
3544
|
let a = 0;
|
|
3545
3545
|
for (let h = n.start, l = n.start + n.count; h < l; h++) {
|
|
3546
3546
|
let m = h;
|
|
3547
|
-
|
|
3547
|
+
r && (m = r.getX(m)), U.fromBufferAttribute(o, m), a = Math.max(
|
|
3548
3548
|
a,
|
|
3549
3549
|
s.center.distanceToSquared(U)
|
|
3550
3550
|
);
|
|
@@ -3603,9 +3603,9 @@ class Ri extends d.Mesh {
|
|
|
3603
3603
|
if (n.bboxIntersectionCheck) {
|
|
3604
3604
|
const s = n.boundingBox;
|
|
3605
3605
|
if (t.ray.intersectBox(s, U)) {
|
|
3606
|
-
const
|
|
3606
|
+
const r = t.ray.origin.distanceTo(U);
|
|
3607
3607
|
i.push({
|
|
3608
|
-
distance:
|
|
3608
|
+
distance: r,
|
|
3609
3609
|
point: U.clone(),
|
|
3610
3610
|
object: this,
|
|
3611
3611
|
face: null,
|
|
@@ -3623,9 +3623,9 @@ class Ri extends d.Mesh {
|
|
|
3623
3623
|
n.start,
|
|
3624
3624
|
n.count
|
|
3625
3625
|
), W.raycast(t, ge);
|
|
3626
|
-
for (let s = 0,
|
|
3627
|
-
const
|
|
3628
|
-
|
|
3626
|
+
for (let s = 0, r = ge.length; s < r; s++) {
|
|
3627
|
+
const o = ge[s];
|
|
3628
|
+
o.object = this, o.batchId = e, o.objectId = n.objectId, i.push(o);
|
|
3629
3629
|
}
|
|
3630
3630
|
ge.length = 0;
|
|
3631
3631
|
}
|
|
@@ -3671,9 +3671,9 @@ class Oi extends d.Points {
|
|
|
3671
3671
|
const t = this.geometry, i = this._maxVertexCount;
|
|
3672
3672
|
if (this._geometryInitialized === !1) {
|
|
3673
3673
|
for (const n in e.attributes) {
|
|
3674
|
-
const s = e.getAttribute(n), { array:
|
|
3674
|
+
const s = e.getAttribute(n), { array: r, itemSize: o, normalized: a } = s, h = new r.constructor(i * o), l = new d.BufferAttribute(
|
|
3675
3675
|
h,
|
|
3676
|
-
|
|
3676
|
+
o,
|
|
3677
3677
|
a
|
|
3678
3678
|
);
|
|
3679
3679
|
t.setAttribute(n, l);
|
|
@@ -3756,22 +3756,22 @@ class Oi extends d.Points {
|
|
|
3756
3756
|
if (e >= this._geometryCount)
|
|
3757
3757
|
throw new Error("AcTrBatchedLine: Maximum geometry count reached.");
|
|
3758
3758
|
this._validateGeometry(t);
|
|
3759
|
-
const i = this.geometry, n = this._geometryInfo[e], s = n.vertexStart,
|
|
3759
|
+
const i = this.geometry, n = this._geometryInfo[e], s = n.vertexStart, r = n.reservedVertexCount;
|
|
3760
3760
|
n.vertexCount = t.getAttribute("position").count;
|
|
3761
|
-
for (const
|
|
3762
|
-
const a = t.getAttribute(
|
|
3763
|
-
|
|
3761
|
+
for (const o in i.attributes) {
|
|
3762
|
+
const a = t.getAttribute(o), h = i.getAttribute(
|
|
3763
|
+
o
|
|
3764
3764
|
);
|
|
3765
3765
|
je(a, h, s);
|
|
3766
3766
|
const l = a.itemSize;
|
|
3767
|
-
for (let m = a.count, u =
|
|
3767
|
+
for (let m = a.count, u = r; m < u; m++) {
|
|
3768
3768
|
const p = s + m;
|
|
3769
3769
|
for (let g = 0; g < l; g++)
|
|
3770
3770
|
h.setComponent(p, g, 0);
|
|
3771
3771
|
}
|
|
3772
3772
|
h.needsUpdate = !0, h.addUpdateRange(
|
|
3773
3773
|
s * l,
|
|
3774
|
-
|
|
3774
|
+
r * l
|
|
3775
3775
|
);
|
|
3776
3776
|
}
|
|
3777
3777
|
return n.boundingBox = null, t.boundingBox !== null && (n.boundingBox = t.boundingBox.clone()), n.boundingSphere = null, t.boundingSphere !== null && (n.boundingSphere = t.boundingSphere.clone()), e;
|
|
@@ -3782,9 +3782,9 @@ class Oi extends d.Points {
|
|
|
3782
3782
|
}
|
|
3783
3783
|
optimize() {
|
|
3784
3784
|
let e = 0;
|
|
3785
|
-
const t = this._geometryInfo, i = t.map((s,
|
|
3786
|
-
for (let s = 0,
|
|
3787
|
-
const
|
|
3785
|
+
const t = this._geometryInfo, i = t.map((s, r) => r).sort((s, r) => t[s].vertexStart - t[r].vertexStart), n = this.geometry;
|
|
3786
|
+
for (let s = 0, r = t.length; s < r; s++) {
|
|
3787
|
+
const o = i[s], a = t[o];
|
|
3788
3788
|
if (a.active !== !1) {
|
|
3789
3789
|
if (a.vertexStart !== e) {
|
|
3790
3790
|
const { vertexStart: h, reservedVertexCount: l } = a, m = n.attributes;
|
|
@@ -3812,10 +3812,10 @@ class Oi extends d.Points {
|
|
|
3812
3812
|
return null;
|
|
3813
3813
|
const i = this.geometry, n = this._geometryInfo[e];
|
|
3814
3814
|
if (n.boundingBox === null) {
|
|
3815
|
-
const s = new d.Box3(),
|
|
3815
|
+
const s = new d.Box3(), r = i.index, o = i.attributes.position;
|
|
3816
3816
|
for (let a = n.vertexStart, h = n.vertexStart + n.vertexCount; a < h; a++) {
|
|
3817
3817
|
let l = a;
|
|
3818
|
-
|
|
3818
|
+
r && (l = r.getX(l)), s.expandByPoint(X.fromBufferAttribute(o, l));
|
|
3819
3819
|
}
|
|
3820
3820
|
n.boundingBox = s;
|
|
3821
3821
|
}
|
|
@@ -3829,11 +3829,11 @@ class Oi extends d.Points {
|
|
|
3829
3829
|
if (n.boundingSphere === null) {
|
|
3830
3830
|
const s = new d.Sphere();
|
|
3831
3831
|
this.getBoundingBoxAt(e, qe), qe.getCenter(s.center);
|
|
3832
|
-
const
|
|
3832
|
+
const r = i.index, o = i.attributes.position;
|
|
3833
3833
|
let a = 0;
|
|
3834
3834
|
for (let h = n.vertexStart, l = n.vertexStart + n.vertexCount; h < l; h++) {
|
|
3835
3835
|
let m = h;
|
|
3836
|
-
|
|
3836
|
+
r && (m = r.getX(m)), X.fromBufferAttribute(o, m), a = Math.max(
|
|
3837
3837
|
a,
|
|
3838
3838
|
s.center.distanceToSquared(X)
|
|
3839
3839
|
);
|
|
@@ -3892,9 +3892,9 @@ class Oi extends d.Points {
|
|
|
3892
3892
|
if (n.bboxIntersectionCheck) {
|
|
3893
3893
|
const s = n.boundingBox;
|
|
3894
3894
|
if (t.ray.intersectBox(s, X)) {
|
|
3895
|
-
const
|
|
3895
|
+
const r = t.ray.origin.distanceTo(X);
|
|
3896
3896
|
i.push({
|
|
3897
|
-
distance:
|
|
3897
|
+
distance: r,
|
|
3898
3898
|
point: X.clone(),
|
|
3899
3899
|
object: this,
|
|
3900
3900
|
face: null,
|
|
@@ -3912,9 +3912,9 @@ class Oi extends d.Points {
|
|
|
3912
3912
|
n.vertexStart,
|
|
3913
3913
|
n.vertexCount
|
|
3914
3914
|
), $.raycast(t, pe);
|
|
3915
|
-
for (let s = 0,
|
|
3916
|
-
const
|
|
3917
|
-
|
|
3915
|
+
for (let s = 0, r = pe.length; s < r; s++) {
|
|
3916
|
+
const o = pe[s];
|
|
3917
|
+
o.object = this, o.batchId = e, o.objectId = n.objectId, i.push(o);
|
|
3918
3918
|
}
|
|
3919
3919
|
pe.length = 0;
|
|
3920
3920
|
}
|
|
@@ -4065,11 +4065,11 @@ class Vi extends d.Group {
|
|
|
4065
4065
|
const i = this._entitiesMap.get(e);
|
|
4066
4066
|
if (i) {
|
|
4067
4067
|
const n = [];
|
|
4068
|
-
for (let s = 0,
|
|
4069
|
-
const
|
|
4068
|
+
for (let s = 0, r = i.length; s < r; s++) {
|
|
4069
|
+
const o = i[s];
|
|
4070
4070
|
if (this.getObjectById(
|
|
4071
|
-
|
|
4072
|
-
).intersectWith(
|
|
4071
|
+
o.batchedObjectId
|
|
4072
|
+
).intersectWith(o.batchId, t, n), n.length > 0) return !0;
|
|
4073
4073
|
}
|
|
4074
4074
|
}
|
|
4075
4075
|
return !1;
|
|
@@ -4091,8 +4091,8 @@ class Vi extends d.Group {
|
|
|
4091
4091
|
i && i.forEach((n) => {
|
|
4092
4092
|
const s = this.getObjectById(
|
|
4093
4093
|
n.batchedObjectId
|
|
4094
|
-
).getObjectAt(n.batchId),
|
|
4095
|
-
Ie.setMaterialColor(
|
|
4094
|
+
).getObjectAt(n.batchId), r = Ie.cloneMaterial(s.material);
|
|
4095
|
+
Ie.setMaterialColor(r), s.material = r, s.userData.objectId = e, t.add(s);
|
|
4096
4096
|
});
|
|
4097
4097
|
}
|
|
4098
4098
|
unhighlight(e, t) {
|
|
@@ -4105,20 +4105,20 @@ class Vi extends d.Group {
|
|
|
4105
4105
|
const i = e.material, n = this.getMatchedLineBatches(e);
|
|
4106
4106
|
let s = n.get(i.id);
|
|
4107
4107
|
s == null && (s = new Pi(1e3, 2e3, i), n.set(i.id, s), this.add(s)), e.geometry.applyMatrix4(e.matrixWorld);
|
|
4108
|
-
const
|
|
4109
|
-
return s.setGeometryInfo(
|
|
4108
|
+
const r = s.addGeometry(e.geometry);
|
|
4109
|
+
return s.setGeometryInfo(r, t), {
|
|
4110
4110
|
batchedObjectId: s.id,
|
|
4111
|
-
batchId:
|
|
4111
|
+
batchId: r
|
|
4112
4112
|
};
|
|
4113
4113
|
}
|
|
4114
4114
|
addMesh(e, t) {
|
|
4115
4115
|
const i = e.material, n = this.getMatchedMeshBatches(e);
|
|
4116
4116
|
let s = n.get(i.id);
|
|
4117
4117
|
s == null && (s = new Ri(1e3, 2e3, i), n.set(i.id, s), this.add(s)), e.geometry.applyMatrix4(e.matrixWorld);
|
|
4118
|
-
const
|
|
4119
|
-
return s.setGeometryInfo(
|
|
4118
|
+
const r = s.addGeometry(e.geometry);
|
|
4119
|
+
return s.setGeometryInfo(r, t), {
|
|
4120
4120
|
batchedObjectId: s.id,
|
|
4121
|
-
batchId:
|
|
4121
|
+
batchId: r
|
|
4122
4122
|
};
|
|
4123
4123
|
}
|
|
4124
4124
|
addPoint(e, t) {
|
|
@@ -4315,10 +4315,10 @@ class E extends xt {
|
|
|
4315
4315
|
});
|
|
4316
4316
|
}
|
|
4317
4317
|
createColorArray(e, t) {
|
|
4318
|
-
const i = (e >> 16 & 255) / 256, n = (e >> 8 & 255) / 256, s = (e & 255) / 256,
|
|
4319
|
-
for (let
|
|
4320
|
-
|
|
4321
|
-
return
|
|
4318
|
+
const i = (e >> 16 & 255) / 256, n = (e >> 8 & 255) / 256, s = (e & 255) / 256, r = new Float32Array(t * 3);
|
|
4319
|
+
for (let o = 0, a = 0; o < t; o++)
|
|
4320
|
+
r[a] = i, r[a + 1] = n, r[a + 2] = s, a += 3;
|
|
4321
|
+
return r;
|
|
4322
4322
|
}
|
|
4323
4323
|
}
|
|
4324
4324
|
const _t = class H {
|
|
@@ -4377,12 +4377,12 @@ class Gi extends E {
|
|
|
4377
4377
|
super(i);
|
|
4378
4378
|
const n = URL.createObjectURL(e), s = new d.TextureLoader().load(n);
|
|
4379
4379
|
s.colorSpace = d.SRGBColorSpace;
|
|
4380
|
-
const
|
|
4380
|
+
const r = new d.MeshBasicMaterial({
|
|
4381
4381
|
side: d.DoubleSide,
|
|
4382
4382
|
map: s
|
|
4383
|
-
}),
|
|
4383
|
+
}), o = new d.Shape(t.boundary), a = new d.ShapeGeometry(o);
|
|
4384
4384
|
this.generateUVs(a);
|
|
4385
|
-
const h = new d.Mesh(a,
|
|
4385
|
+
const h = new d.Mesh(a, r);
|
|
4386
4386
|
this.add(h);
|
|
4387
4387
|
}
|
|
4388
4388
|
/**
|
|
@@ -4391,10 +4391,10 @@ class Gi extends E {
|
|
|
4391
4391
|
* @param geometry Input geometry to generate UVs
|
|
4392
4392
|
*/
|
|
4393
4393
|
generateUVs(e) {
|
|
4394
|
-
const t = e.attributes.position.array, i = new Float32Array(t.length / 3 * 2), n = Math.min(...t.filter((l, m) => m % 3 === 0)), s = Math.max(...t.filter((l, m) => m % 3 === 0)),
|
|
4394
|
+
const t = e.attributes.position.array, i = new Float32Array(t.length / 3 * 2), n = Math.min(...t.filter((l, m) => m % 3 === 0)), s = Math.max(...t.filter((l, m) => m % 3 === 0)), r = Math.min(...t.filter((l, m) => m % 3 === 1)), o = Math.max(...t.filter((l, m) => m % 3 === 1)), a = s - n, h = o - r;
|
|
4395
4395
|
for (let l = 0; l < t.length; l += 3) {
|
|
4396
4396
|
const m = t[l], u = t[l + 1];
|
|
4397
|
-
i[l / 3 * 2] = (m - n) / a, i[l / 3 * 2 + 1] = (u -
|
|
4397
|
+
i[l / 3 * 2] = (m - n) / a, i[l / 3 * 2 + 1] = (u - r) / h;
|
|
4398
4398
|
}
|
|
4399
4399
|
e.setAttribute("uv", new d.BufferAttribute(i, 2));
|
|
4400
4400
|
}
|
|
@@ -4426,13 +4426,13 @@ class le {
|
|
|
4426
4426
|
return t;
|
|
4427
4427
|
}
|
|
4428
4428
|
static createGeometryAttributeByIndex(e, t) {
|
|
4429
|
-
const i = t.count, n = e.itemSize, s = e.array.constructor,
|
|
4430
|
-
for (let
|
|
4431
|
-
const a = t.getX(
|
|
4429
|
+
const i = t.count, n = e.itemSize, s = e.array.constructor, r = new s(i * n);
|
|
4430
|
+
for (let o = 0; o < i; o++) {
|
|
4431
|
+
const a = t.getX(o) * n;
|
|
4432
4432
|
for (let h = 0; h < n; h++)
|
|
4433
|
-
o
|
|
4433
|
+
r[o * n + h] = e.array[a + h];
|
|
4434
4434
|
}
|
|
4435
|
-
return new d.BufferAttribute(
|
|
4435
|
+
return new d.BufferAttribute(r, n, e.normalized);
|
|
4436
4436
|
}
|
|
4437
4437
|
/**
|
|
4438
4438
|
* Converts InterleavedBufferAttribute to BufferAttribute, because mergeGeometries doesn't support InterleavedBufferAttribute.
|
|
@@ -4449,9 +4449,9 @@ class le {
|
|
|
4449
4449
|
}
|
|
4450
4450
|
static createBufferGeometryByPoints(e) {
|
|
4451
4451
|
const t = new d.BufferGeometry(), i = new Float32Array(e.length * 3), n = new Uint16Array((e.length - 1) * 2);
|
|
4452
|
-
return e.forEach((s,
|
|
4453
|
-
let
|
|
4454
|
-
i[
|
|
4452
|
+
return e.forEach((s, r) => {
|
|
4453
|
+
let o = r * 3;
|
|
4454
|
+
i[o] = s.x, i[o + 1] = s.y, i[o + 2] = s.z, r > 0 && (o = (r - 1) * 2, n[o] = r - 1, n[o + 1] = r);
|
|
4455
4455
|
}), t.setAttribute(
|
|
4456
4456
|
"position",
|
|
4457
4457
|
new d.Float32BufferAttribute(i, 3)
|
|
@@ -4466,18 +4466,18 @@ class le {
|
|
|
4466
4466
|
const s = i.attributes.position;
|
|
4467
4467
|
if (!s || s.count === 0)
|
|
4468
4468
|
return;
|
|
4469
|
-
const
|
|
4469
|
+
const r = [];
|
|
4470
4470
|
if (t)
|
|
4471
|
-
for (let
|
|
4472
|
-
ye.fromBufferAttribute(s,
|
|
4471
|
+
for (let o = 0, a = s.count; o < a; o += 2)
|
|
4472
|
+
ye.fromBufferAttribute(s, o).applyMatrix4(n), fe.fromBufferAttribute(s, o + 1).applyMatrix4(n), r[o] = o === 0 ? 0 : r[o - 1], r[o + 1] = r[o] + ye.distanceTo(fe);
|
|
4473
4473
|
else {
|
|
4474
|
-
|
|
4475
|
-
for (let
|
|
4476
|
-
ye.fromBufferAttribute(s,
|
|
4474
|
+
r[0] = 0;
|
|
4475
|
+
for (let o = 1, a = s.count; o < a; o++)
|
|
4476
|
+
ye.fromBufferAttribute(s, o - 1).applyMatrix4(n), fe.fromBufferAttribute(s, o).applyMatrix4(n), r[o] = r[o - 1], r[o] += ye.distanceTo(fe);
|
|
4477
4477
|
}
|
|
4478
4478
|
i.setAttribute(
|
|
4479
4479
|
"lineDistance",
|
|
4480
|
-
new d.Float32BufferAttribute(
|
|
4480
|
+
new d.Float32BufferAttribute(r, 1)
|
|
4481
4481
|
), e.geometry.dispose(), e.geometry = i;
|
|
4482
4482
|
}
|
|
4483
4483
|
}
|
|
@@ -4495,16 +4495,16 @@ class le {
|
|
|
4495
4495
|
* @param scale Input scale factor
|
|
4496
4496
|
*/
|
|
4497
4497
|
static apply2dTransform(e, t, i = 0, n = 1) {
|
|
4498
|
-
const s = e.attributes.position,
|
|
4498
|
+
const s = e.attributes.position, r = s.itemSize, o = s.array;
|
|
4499
4499
|
if (i != 0) {
|
|
4500
4500
|
const a = Math.cos(i), h = Math.sin(i);
|
|
4501
|
-
for (let l = 0; l <
|
|
4502
|
-
const m =
|
|
4503
|
-
|
|
4501
|
+
for (let l = 0; l < o.length; l += r) {
|
|
4502
|
+
const m = o[l], u = o[l + 1], p = m * a - u * h, g = m * h + u * a;
|
|
4503
|
+
o[l] = p * n + t.x, o[l + 1] = g * n + t.y;
|
|
4504
4504
|
}
|
|
4505
4505
|
} else
|
|
4506
|
-
for (let a = 0; a <
|
|
4507
|
-
|
|
4506
|
+
for (let a = 0; a < o.length; a += r)
|
|
4507
|
+
o[a] = o[a] * n + t.x, o[a + 1] += o[a + 1] * n + t.y;
|
|
4508
4508
|
return s.needsUpdate = !0, e;
|
|
4509
4509
|
}
|
|
4510
4510
|
/**
|
|
@@ -4514,12 +4514,12 @@ class le {
|
|
|
4514
4514
|
* @param rotation Input roatation (in radians) around x-axis, y-axis, and z-axis
|
|
4515
4515
|
*/
|
|
4516
4516
|
static apply3dTransform(e, t, i) {
|
|
4517
|
-
const n = e.attributes.position, s = n.itemSize,
|
|
4518
|
-
for (let p = 0; p <
|
|
4519
|
-
let g =
|
|
4517
|
+
const n = e.attributes.position, s = n.itemSize, r = n.array, o = Math.cos(i.x), a = Math.sin(i.x), h = Math.cos(i.y), l = Math.sin(i.y), m = Math.cos(i.z), u = Math.sin(i.z);
|
|
4518
|
+
for (let p = 0; p < r.length; p += s) {
|
|
4519
|
+
let g = r[p], y = r[p + 1], f = r[p + 2], _ = y * o - f * a, x = y * a + f * o;
|
|
4520
4520
|
y = _, f = x;
|
|
4521
4521
|
let w = g * h + f * l;
|
|
4522
|
-
x = -g * l + f * h, g = w, f = x, w = g * m - y * u, _ = g * u + y * m, g = w, y = _,
|
|
4522
|
+
x = -g * l + f * h, g = w, f = x, w = g * m - y * u, _ = g * u + y * m, g = w, y = _, r[p] = g + t.x, r[p + 1] = y + t.y, r[p + 2] = f + t.z;
|
|
4523
4523
|
}
|
|
4524
4524
|
return n.needsUpdate = !0, e;
|
|
4525
4525
|
}
|
|
@@ -4530,15 +4530,15 @@ class ki extends E {
|
|
|
4530
4530
|
let n;
|
|
4531
4531
|
const s = t ? t.color : 16777215;
|
|
4532
4532
|
t ? n = this.styleManager.getLineShaderMaterial(t, 1) : n = new d.LineBasicMaterial({ color: s });
|
|
4533
|
-
const
|
|
4534
|
-
for (let m = 0, u = 0; m <
|
|
4533
|
+
const r = e.length, o = new Float32Array(r * 3), a = r * 2 > 65535 ? new Uint32Array(r * 2) : new Uint16Array(r * 2);
|
|
4534
|
+
for (let m = 0, u = 0; m < r; m++) {
|
|
4535
4535
|
const p = e[m];
|
|
4536
|
-
|
|
4536
|
+
o[u++] = p.x, o[u++] = p.y, o[u++] = p.z ?? 0;
|
|
4537
4537
|
}
|
|
4538
|
-
for (let m = 0, u = 0; m <
|
|
4538
|
+
for (let m = 0, u = 0; m < r - 1; m++)
|
|
4539
4539
|
a[u++] = m, a[u++] = m + 1;
|
|
4540
4540
|
const h = new d.BufferGeometry();
|
|
4541
|
-
h.setAttribute("position", new d.BufferAttribute(
|
|
4541
|
+
h.setAttribute("position", new d.BufferAttribute(o, 3)), h.setIndex(new d.BufferAttribute(a, 1)), this.setBoundingBox(h), this.geometry = h;
|
|
4542
4542
|
const l = new d.LineSegments(h, n);
|
|
4543
4543
|
le.computeLineDistances(l), this.add(l);
|
|
4544
4544
|
}
|
|
@@ -4549,14 +4549,14 @@ class ki extends E {
|
|
|
4549
4549
|
class Fi extends E {
|
|
4550
4550
|
constructor(e, t, i, n, s) {
|
|
4551
4551
|
super(s);
|
|
4552
|
-
let
|
|
4553
|
-
n ?
|
|
4554
|
-
const
|
|
4555
|
-
|
|
4552
|
+
let r;
|
|
4553
|
+
n ? r = this.styleManager.getLineShaderMaterial(n, 1) : r = new d.LineBasicMaterial({ color: 16777215 });
|
|
4554
|
+
const o = new d.BufferGeometry();
|
|
4555
|
+
o.setAttribute(
|
|
4556
4556
|
"position",
|
|
4557
4557
|
new d.BufferAttribute(e, t)
|
|
4558
|
-
),
|
|
4559
|
-
const a = new d.LineSegments(
|
|
4558
|
+
), o.setIndex(new d.BufferAttribute(i, 1)), o.computeBoundingBox(), this.box = o.boundingBox;
|
|
4559
|
+
const a = new d.LineSegments(o, r);
|
|
4560
4560
|
le.computeLineDistances(a), this.add(a);
|
|
4561
4561
|
}
|
|
4562
4562
|
}
|
|
@@ -4606,8 +4606,8 @@ class Wi extends E {
|
|
|
4606
4606
|
this.isShowPoint = n.point != null;
|
|
4607
4607
|
const s = n.point ?? new d.BufferGeometry().setFromPoints([Ui.copy(e)]);
|
|
4608
4608
|
s.computeBoundingBox(), s.boundingBox && this.box.union(s.boundingBox);
|
|
4609
|
-
const
|
|
4610
|
-
if (
|
|
4609
|
+
const r = this.styleManager.getPointsMaterial(t.color), o = new d.Points(s, r);
|
|
4610
|
+
if (o.userData.bboxIntersectionCheck = !0, o.visible = this.isShowPoint, this.add(o), n.line) {
|
|
4611
4611
|
const a = n.line;
|
|
4612
4612
|
a.computeBoundingBox(), a.boundingBox && this.box.union(a.boundingBox);
|
|
4613
4613
|
const h = this.styleManager.getLineBasicMaterial(t.color), l = new d.LineSegments(a, h);
|
|
@@ -4619,10 +4619,10 @@ class Xi extends E {
|
|
|
4619
4619
|
constructor(e, t, i) {
|
|
4620
4620
|
var n;
|
|
4621
4621
|
super(i);
|
|
4622
|
-
const s = e.getPoints(100),
|
|
4623
|
-
this.buildHatchGeometry(s,
|
|
4622
|
+
const s = e.getPoints(100), r = e.buildHierarchy(), o = [];
|
|
4623
|
+
this.buildHatchGeometry(s, r, o);
|
|
4624
4624
|
let a;
|
|
4625
|
-
if (
|
|
4625
|
+
if (o.length > 0 && (a = Qt(o)), !a || !a.getIndex() || ((n = a.getIndex()) == null ? void 0 : n.count) === 0)
|
|
4626
4626
|
console.warn("Failed to convert hatch boundaries!");
|
|
4627
4627
|
else {
|
|
4628
4628
|
a.computeBoundingBox(), this.box = a.boundingBox;
|
|
@@ -4643,7 +4643,7 @@ class Xi extends E {
|
|
|
4643
4643
|
a.children.map((h) => h.index)
|
|
4644
4644
|
);
|
|
4645
4645
|
});
|
|
4646
|
-
const
|
|
4646
|
+
const r = (a) => {
|
|
4647
4647
|
try {
|
|
4648
4648
|
const h = new d.ShapeGeometry(a);
|
|
4649
4649
|
h.hasAttribute("uv") && h.deleteAttribute("uv"), h.hasAttribute("normal") && h.deleteAttribute("normal"), i.push(h);
|
|
@@ -4658,9 +4658,9 @@ class Xi extends E {
|
|
|
4658
4658
|
if (h.length === 0)
|
|
4659
4659
|
return;
|
|
4660
4660
|
const l = new d.Shape(h);
|
|
4661
|
-
|
|
4661
|
+
r(l);
|
|
4662
4662
|
});
|
|
4663
|
-
const
|
|
4663
|
+
const o = (a) => a.map((h) => h.toArray());
|
|
4664
4664
|
for (const a of s) {
|
|
4665
4665
|
const h = new d.Shape(
|
|
4666
4666
|
e[a[0]]
|
|
@@ -4681,12 +4681,12 @@ class Xi extends E {
|
|
|
4681
4681
|
const x = new ft(new yt(y));
|
|
4682
4682
|
if (_ === 0)
|
|
4683
4683
|
g = x.segments({
|
|
4684
|
-
regions: [
|
|
4684
|
+
regions: [o(e[f])],
|
|
4685
4685
|
inverted: !1
|
|
4686
4686
|
});
|
|
4687
4687
|
else {
|
|
4688
4688
|
const w = x.segments({
|
|
4689
|
-
regions: [
|
|
4689
|
+
regions: [o(e[f])],
|
|
4690
4690
|
inverted: !1
|
|
4691
4691
|
}), b = x.combine(g, w);
|
|
4692
4692
|
l = x.polygon(x.selectUnion(b)), l.regions.length > 0 ? l.regions.forEach((I) => {
|
|
@@ -4710,7 +4710,7 @@ class Xi extends E {
|
|
|
4710
4710
|
new d.Path(e[g])
|
|
4711
4711
|
);
|
|
4712
4712
|
}
|
|
4713
|
-
|
|
4713
|
+
r(h);
|
|
4714
4714
|
}
|
|
4715
4715
|
t.children.forEach((a) => {
|
|
4716
4716
|
a.children.forEach((h) => {
|
|
@@ -4721,17 +4721,17 @@ class Xi extends E {
|
|
|
4721
4721
|
findIntersectHole(e, t) {
|
|
4722
4722
|
const i = t.length, n = [];
|
|
4723
4723
|
for (let s = 0; s < i; s++) {
|
|
4724
|
-
const
|
|
4725
|
-
let
|
|
4724
|
+
const r = e[t[s]];
|
|
4725
|
+
let o = !1;
|
|
4726
4726
|
const a = [];
|
|
4727
4727
|
for (let h = s + 1; h < i; h++) {
|
|
4728
4728
|
const l = e[t[h]];
|
|
4729
4729
|
St.isPolygonIntersect(
|
|
4730
|
-
|
|
4730
|
+
r,
|
|
4731
4731
|
l
|
|
4732
|
-
) && (
|
|
4732
|
+
) && (o = !0, a.push(t[h]));
|
|
4733
4733
|
}
|
|
4734
|
-
|
|
4734
|
+
o && (a.push(t[s]), n.push(a));
|
|
4735
4735
|
}
|
|
4736
4736
|
return n;
|
|
4737
4737
|
}
|
|
@@ -4742,7 +4742,7 @@ function $i(c, e, t, i, n = 0) {
|
|
|
4742
4742
|
u_patternLines: { value: c },
|
|
4743
4743
|
u_patternAngle: { value: e },
|
|
4744
4744
|
u_color: { value: i }
|
|
4745
|
-
},
|
|
4745
|
+
}, r = (
|
|
4746
4746
|
/*glsl*/
|
|
4747
4747
|
`
|
|
4748
4748
|
varying vec3 v_pos;
|
|
@@ -4756,7 +4756,7 @@ function $i(c, e, t, i, n = 0) {
|
|
|
4756
4756
|
#include <project_vertex>
|
|
4757
4757
|
#include <clipping_planes_vertex>
|
|
4758
4758
|
}`
|
|
4759
|
-
),
|
|
4759
|
+
), o = (
|
|
4760
4760
|
/*glsl*/
|
|
4761
4761
|
`
|
|
4762
4762
|
uniform mat4 modelMatrix;
|
|
@@ -4951,8 +4951,8 @@ function $i(c, e, t, i, n = 0) {
|
|
|
4951
4951
|
);
|
|
4952
4952
|
return new d.ShaderMaterial({
|
|
4953
4953
|
uniforms: s,
|
|
4954
|
-
vertexShader:
|
|
4955
|
-
fragmentShader:
|
|
4954
|
+
vertexShader: r,
|
|
4955
|
+
fragmentShader: o,
|
|
4956
4956
|
clipping: !0
|
|
4957
4957
|
});
|
|
4958
4958
|
}
|
|
@@ -4962,17 +4962,17 @@ class Yi {
|
|
|
4962
4962
|
* Note: remember to call line.computeLineDistances() in order to make it work!
|
|
4963
4963
|
*/
|
|
4964
4964
|
static createLineShaderMaterial(e, t, i, n, s) {
|
|
4965
|
-
let
|
|
4966
|
-
const
|
|
4965
|
+
let r = 0;
|
|
4966
|
+
const o = [];
|
|
4967
4967
|
for (let m = 0; m < e.length; m++)
|
|
4968
|
-
|
|
4969
|
-
for (let m = 0; m <
|
|
4970
|
-
|
|
4968
|
+
o[m] = e[m].elementLength * i, r += Math.abs(o[m]);
|
|
4969
|
+
for (let m = 0; m < o.length; m++)
|
|
4970
|
+
o[m] === 0 && (o[m] = r * 0.01 * i, r += o[m]);
|
|
4971
4971
|
const a = d.UniformsUtils.merge([
|
|
4972
4972
|
d.UniformsLib.common,
|
|
4973
4973
|
{
|
|
4974
|
-
pattern: { value:
|
|
4975
|
-
patternLength: { value:
|
|
4974
|
+
pattern: { value: o },
|
|
4975
|
+
patternLength: { value: r },
|
|
4976
4976
|
u_color: { value: new d.Color(t) }
|
|
4977
4977
|
}
|
|
4978
4978
|
]);
|
|
@@ -5091,12 +5091,12 @@ const we = class oe {
|
|
|
5091
5091
|
const n = this.findMatchedHatchShaderMaterial(e);
|
|
5092
5092
|
if (n)
|
|
5093
5093
|
return n;
|
|
5094
|
-
const s = 5e-3,
|
|
5095
|
-
let
|
|
5094
|
+
const s = 5e-3, r = 0.05;
|
|
5095
|
+
let o = 2;
|
|
5096
5096
|
e.patternLines.forEach((u) => {
|
|
5097
|
-
|
|
5097
|
+
o = Math.max(
|
|
5098
5098
|
u.dashPattern.length,
|
|
5099
|
-
|
|
5099
|
+
o
|
|
5100
5100
|
);
|
|
5101
5101
|
});
|
|
5102
5102
|
let a = 0;
|
|
@@ -5122,14 +5122,14 @@ const we = class oe {
|
|
|
5122
5122
|
const G = u.dashPattern[v];
|
|
5123
5123
|
G > 0 && (f = !1), _ += Math.abs(G);
|
|
5124
5124
|
}
|
|
5125
|
-
const x = f ?
|
|
5125
|
+
const x = f ? r : s, w = [], b = [];
|
|
5126
5126
|
let I = 0;
|
|
5127
5127
|
b[0] = I;
|
|
5128
5128
|
for (let v = 0; v < y; ++v)
|
|
5129
5129
|
w[v] = u.dashPattern[v], w[v] === 0 && (w[v] = x * _), I += Math.abs(w[v]), b[v + 1] = I;
|
|
5130
|
-
for (let v = y; v <
|
|
5130
|
+
for (let v = y; v < o; ++v)
|
|
5131
5131
|
w[v] = 0;
|
|
5132
|
-
for (let v = b.length; v <
|
|
5132
|
+
for (let v = b.length; v < o + 1; ++v)
|
|
5133
5133
|
b[v] = I;
|
|
5134
5134
|
const P = {
|
|
5135
5135
|
origin: p,
|
|
@@ -5139,7 +5139,7 @@ const we = class oe {
|
|
|
5139
5139
|
patternSum: b,
|
|
5140
5140
|
patternLength: I
|
|
5141
5141
|
};
|
|
5142
|
-
if (a += 4, a +=
|
|
5142
|
+
if (a += 4, a += o, a += o + 1, a > oe.MaxFragmentUniforms) {
|
|
5143
5143
|
console.warn(
|
|
5144
5144
|
"There will be warning in fragment shader when number of uniforms exceeds 1024, so extra hatch line patterns are ignored here!"
|
|
5145
5145
|
);
|
|
@@ -5154,7 +5154,7 @@ const we = class oe {
|
|
|
5154
5154
|
new d.Color(e.color)
|
|
5155
5155
|
);
|
|
5156
5156
|
return m.defines = {
|
|
5157
|
-
MAX_PATTERN_SEGMENT_COUNT:
|
|
5157
|
+
MAX_PATTERN_SEGMENT_COUNT: o
|
|
5158
5158
|
}, this.hatchShaderMaterials.push({
|
|
5159
5159
|
patternLines: e.patternLines,
|
|
5160
5160
|
patternAngle: e.patternAngle,
|
|
@@ -5173,15 +5173,15 @@ const we = class oe {
|
|
|
5173
5173
|
if (!i(a[l], h[l]))
|
|
5174
5174
|
return !1;
|
|
5175
5175
|
return !0;
|
|
5176
|
-
}, s = (a, h) => i(a.angle, h.angle) && i(a.delta.x, h.delta.x) && i(a.delta.y, h.delta.y) && i(a.origin.x, h.origin.x) && i(a.origin.y, h.origin.y) && n(a.dashPattern, h.dashPattern),
|
|
5176
|
+
}, s = (a, h) => i(a.angle, h.angle) && i(a.delta.x, h.delta.x) && i(a.delta.y, h.delta.y) && i(a.origin.x, h.origin.x) && i(a.origin.y, h.origin.y) && n(a.dashPattern, h.dashPattern), r = (a, h) => {
|
|
5177
5177
|
if (a.length !== h.length)
|
|
5178
5178
|
return !1;
|
|
5179
5179
|
for (let l = 0; l < a.length; ++l)
|
|
5180
5180
|
if (!s(a[l], h[l]))
|
|
5181
5181
|
return !1;
|
|
5182
5182
|
return !0;
|
|
5183
|
-
},
|
|
5184
|
-
return
|
|
5183
|
+
}, o = this.hatchShaderMaterials.find((a) => a.color === e.color && a.patternAngle === e.patternAngle && r(a.patternLines, t));
|
|
5184
|
+
return o == null ? void 0 : o.material;
|
|
5185
5185
|
}
|
|
5186
5186
|
};
|
|
5187
5187
|
we.CameraZoomUniform = { value: 1 }, we.ViewportScaleUniform = { value: 1 }, we.MaxFragmentUniforms = 1024;
|
|
@@ -5565,7 +5565,7 @@ class bt {
|
|
|
5565
5565
|
e.getCenter(n);
|
|
5566
5566
|
const s = new d.Vector3(n.x, n.y, 0);
|
|
5567
5567
|
this._camera.position.set(n.x, n.y, this._camera.position.z), this._camera.lookAt(s), this._camera.setRotationFromEuler(new d.Euler(0, 0, 0));
|
|
5568
|
-
const
|
|
5568
|
+
const r = i.x * t, o = i.y * t, a = this._width / r, h = this._height / o;
|
|
5569
5569
|
this._camera.zoom = Math.min(a, h), this._cameraControls.target = s, this.updateCameraFrustum();
|
|
5570
5570
|
}
|
|
5571
5571
|
updateCameraFrustum(e, t) {
|
|
@@ -5725,53 +5725,53 @@ class on extends d.Object3D {
|
|
|
5725
5725
|
}
|
|
5726
5726
|
calculateViewportPos() {
|
|
5727
5727
|
const e = this.renderer.domElement, t = e.offsetWidth, i = e.offsetHeight, n = this.gizmoPos, s = this.gizmoDim;
|
|
5728
|
-
let
|
|
5728
|
+
let r = t - s, o = i - s;
|
|
5729
5729
|
switch (n) {
|
|
5730
5730
|
case 0:
|
|
5731
|
-
|
|
5731
|
+
r = 0, o = 0;
|
|
5732
5732
|
break;
|
|
5733
5733
|
case 1:
|
|
5734
|
-
|
|
5734
|
+
r = 0;
|
|
5735
5735
|
break;
|
|
5736
5736
|
case 4:
|
|
5737
|
-
|
|
5737
|
+
o = 0;
|
|
5738
5738
|
break;
|
|
5739
5739
|
}
|
|
5740
|
-
return { x:
|
|
5740
|
+
return { x: r, y: o };
|
|
5741
5741
|
}
|
|
5742
5742
|
calculateViewportBbox() {
|
|
5743
|
-
const e = this.renderer.domElement, t = e.offsetWidth, i = e.offsetHeight, n = this.gizmoPos, s = this.gizmoDim,
|
|
5743
|
+
const e = this.renderer.domElement, t = e.offsetWidth, i = e.offsetHeight, n = this.gizmoPos, s = this.gizmoDim, r = new d.Box2(
|
|
5744
5744
|
new d.Vector2(t - s, 0),
|
|
5745
5745
|
new d.Vector2(t, s)
|
|
5746
5746
|
);
|
|
5747
5747
|
switch (n) {
|
|
5748
5748
|
case 0:
|
|
5749
|
-
|
|
5749
|
+
r.set(
|
|
5750
5750
|
new d.Vector2(0, i - s),
|
|
5751
5751
|
new d.Vector2(s, i)
|
|
5752
5752
|
);
|
|
5753
5753
|
break;
|
|
5754
5754
|
case 1:
|
|
5755
|
-
|
|
5755
|
+
r.set(new d.Vector2(0, 0), new d.Vector2(s, s));
|
|
5756
5756
|
break;
|
|
5757
5757
|
case 4:
|
|
5758
|
-
|
|
5758
|
+
r.set(
|
|
5759
5759
|
new d.Vector2(t - s, i - s),
|
|
5760
5760
|
new d.Vector2(t, i)
|
|
5761
5761
|
);
|
|
5762
5762
|
break;
|
|
5763
5763
|
}
|
|
5764
|
-
return
|
|
5764
|
+
return r;
|
|
5765
5765
|
}
|
|
5766
5766
|
}
|
|
5767
5767
|
function an(c, e) {
|
|
5768
|
-
const t = e.font || "Helvetica", i = e.fontSize || 30, n = e.width || 200, s = e.height || 200,
|
|
5768
|
+
const t = e.font || "Helvetica", i = e.fontSize || 30, n = e.width || 200, s = e.height || 200, r = e.bgColor ? e.bgColor.join(", ") : "255, 255, 255, 1.0", o = e.color ? e.color.join(", ") : "0, 0, 0, 1.0", a = document.createElement("canvas");
|
|
5769
5769
|
a.width = n, a.height = s;
|
|
5770
5770
|
const h = a.getContext("2d");
|
|
5771
5771
|
if (h) {
|
|
5772
|
-
h.font = `bold ${i}px ${t}`, h.fillStyle = `rgba(${
|
|
5772
|
+
h.font = `bold ${i}px ${t}`, h.fillStyle = `rgba(${r})`, h.fillRect(0, 0, n, s);
|
|
5773
5773
|
const u = h.measureText(c).width;
|
|
5774
|
-
h.fillStyle = `rgba(${
|
|
5774
|
+
h.fillStyle = `rgba(${o})`, h.fillText(
|
|
5775
5775
|
c,
|
|
5776
5776
|
n / 2 - u / 2,
|
|
5777
5777
|
s / 2 + i / 2 - 2
|
|
@@ -5802,18 +5802,18 @@ class hn extends on {
|
|
|
5802
5802
|
...i
|
|
5803
5803
|
};
|
|
5804
5804
|
super(e, t, n.size, i.pos), this.hasZAxis = n.hasZAxis;
|
|
5805
|
-
const s = [0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 2, 0],
|
|
5806
|
-
this.hasZAxis && (s.push(0, 0, 0, 0, 0, 2),
|
|
5807
|
-
const
|
|
5808
|
-
|
|
5805
|
+
const s = [0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 2, 0], r = [1, 0, 0, 1, 0.6, 0, 0, 1, 0, 0.6, 1, 0];
|
|
5806
|
+
this.hasZAxis && (s.push(0, 0, 0, 0, 0, 2), r.push(0, 0, 1, 0, 0.6, 1));
|
|
5807
|
+
const o = new d.BufferGeometry();
|
|
5808
|
+
o.setAttribute(
|
|
5809
5809
|
"position",
|
|
5810
5810
|
new d.Float32BufferAttribute(s, 3)
|
|
5811
|
-
),
|
|
5811
|
+
), o.setAttribute("color", new d.Float32BufferAttribute(r, 3));
|
|
5812
5812
|
const a = new d.LineBasicMaterial({
|
|
5813
5813
|
vertexColors: !0,
|
|
5814
5814
|
toneMapped: !1
|
|
5815
5815
|
});
|
|
5816
|
-
this.axes = new d.LineSegments(
|
|
5816
|
+
this.axes = new d.LineSegments(o, a), this.axes.position.set(-1, -1, -1), this.add(this.axes), this.xText = Ce("X"), this.xText.position.set(1.5, -1, -1), this.add(this.xText), this.yText = Ce("Y"), this.yText.position.set(-1, 1.5, -1), this.add(this.yText), this.hasZAxis && (this.zText = Ce("Z"), this.zText.position.set(-1, -1, 1.5), this.add(this.zText));
|
|
5817
5817
|
}
|
|
5818
5818
|
/**
|
|
5819
5819
|
* Set color of x-axis and y-axis
|
|
@@ -6055,12 +6055,12 @@ function wt(c, e, t = 0, i = c.length - 1, n = un) {
|
|
|
6055
6055
|
wt(c, e, p, g, n);
|
|
6056
6056
|
}
|
|
6057
6057
|
const s = c[e];
|
|
6058
|
-
let
|
|
6059
|
-
for (se(c, t, e), n(c[i], s) > 0 && se(c, t, i);
|
|
6060
|
-
for (se(c,
|
|
6061
|
-
for (; n(c[
|
|
6058
|
+
let r = t, o = i;
|
|
6059
|
+
for (se(c, t, e), n(c[i], s) > 0 && se(c, t, i); r < o; ) {
|
|
6060
|
+
for (se(c, r, o), r++, o--; n(c[r], s) < 0; ) r++;
|
|
6061
|
+
for (; n(c[o], s) > 0; ) o--;
|
|
6062
6062
|
}
|
|
6063
|
-
n(c[t], s) === 0 ? se(c, t,
|
|
6063
|
+
n(c[t], s) === 0 ? se(c, t, o) : (o++, se(c, o, i)), o <= e && (t = o + 1), e <= o && (i = o - 1);
|
|
6064
6064
|
}
|
|
6065
6065
|
}
|
|
6066
6066
|
function se(c, e, t) {
|
|
@@ -6083,9 +6083,9 @@ class mn {
|
|
|
6083
6083
|
if (!_e(e, t)) return i;
|
|
6084
6084
|
const n = this.toBBox, s = [];
|
|
6085
6085
|
for (; t; ) {
|
|
6086
|
-
for (let
|
|
6087
|
-
const
|
|
6088
|
-
_e(e, a) && (t.leaf ? i.push(
|
|
6086
|
+
for (let r = 0; r < t.children.length; r++) {
|
|
6087
|
+
const o = t.children[r], a = t.leaf ? n(o) : o;
|
|
6088
|
+
_e(e, a) && (t.leaf ? i.push(o) : Ee(e, a) ? this._all(o, i) : s.push(o));
|
|
6089
6089
|
}
|
|
6090
6090
|
t = s.pop();
|
|
6091
6091
|
}
|
|
@@ -6097,9 +6097,9 @@ class mn {
|
|
|
6097
6097
|
const i = [];
|
|
6098
6098
|
for (; t; ) {
|
|
6099
6099
|
for (let n = 0; n < t.children.length; n++) {
|
|
6100
|
-
const s = t.children[n],
|
|
6101
|
-
if (_e(e,
|
|
6102
|
-
if (t.leaf || Ee(e,
|
|
6100
|
+
const s = t.children[n], r = t.leaf ? this.toBBox(s) : s;
|
|
6101
|
+
if (_e(e, r)) {
|
|
6102
|
+
if (t.leaf || Ee(e, r)) return !0;
|
|
6103
6103
|
i.push(s);
|
|
6104
6104
|
}
|
|
6105
6105
|
}
|
|
@@ -6137,15 +6137,15 @@ class mn {
|
|
|
6137
6137
|
remove(e, t) {
|
|
6138
6138
|
if (!e) return this;
|
|
6139
6139
|
let i = this.data;
|
|
6140
|
-
const n = this.toBBox(e), s = [],
|
|
6141
|
-
let
|
|
6140
|
+
const n = this.toBBox(e), s = [], r = [];
|
|
6141
|
+
let o, a, h;
|
|
6142
6142
|
for (; i || s.length; ) {
|
|
6143
|
-
if (i || (i = s.pop(), a = s[s.length - 1],
|
|
6143
|
+
if (i || (i = s.pop(), a = s[s.length - 1], o = r.pop(), h = !0), i.leaf) {
|
|
6144
6144
|
const l = gn(e, i.children, t);
|
|
6145
6145
|
if (l !== -1)
|
|
6146
6146
|
return i.children.splice(l, 1), s.push(i), this._condense(s), this;
|
|
6147
6147
|
}
|
|
6148
|
-
!h && !i.leaf && Ee(i, n) ? (s.push(i),
|
|
6148
|
+
!h && !i.leaf && Ee(i, n) ? (s.push(i), r.push(o), o = 0, a = i, i = i.children[0]) : a ? (o++, i = a.children[o], h = !1) : i = null;
|
|
6149
6149
|
}
|
|
6150
6150
|
return this;
|
|
6151
6151
|
}
|
|
@@ -6172,36 +6172,36 @@ class mn {
|
|
|
6172
6172
|
}
|
|
6173
6173
|
_build(e, t, i, n) {
|
|
6174
6174
|
const s = i - t + 1;
|
|
6175
|
-
let
|
|
6176
|
-
if (s <=
|
|
6177
|
-
return
|
|
6178
|
-
n || (n = Math.ceil(Math.log(s) / Math.log(
|
|
6179
|
-
const a = Math.ceil(s /
|
|
6175
|
+
let r = this._maxEntries, o;
|
|
6176
|
+
if (s <= r)
|
|
6177
|
+
return o = q(e.slice(t, i + 1)), Y(o, this.toBBox), o;
|
|
6178
|
+
n || (n = Math.ceil(Math.log(s) / Math.log(r)), r = Math.ceil(s / Math.pow(r, n - 1))), o = q([]), o.leaf = !1, o.height = n;
|
|
6179
|
+
const a = Math.ceil(s / r), h = a * Math.ceil(Math.sqrt(r));
|
|
6180
6180
|
Qe(e, t, i, h, this.compareMinX);
|
|
6181
6181
|
for (let l = t; l <= i; l += h) {
|
|
6182
6182
|
const m = Math.min(l + h - 1, i);
|
|
6183
6183
|
Qe(e, l, m, a, this.compareMinY);
|
|
6184
6184
|
for (let u = l; u <= m; u += a) {
|
|
6185
6185
|
const p = Math.min(u + a - 1, m);
|
|
6186
|
-
|
|
6186
|
+
o.children.push(this._build(e, u, p, n - 1));
|
|
6187
6187
|
}
|
|
6188
6188
|
}
|
|
6189
|
-
return Y(
|
|
6189
|
+
return Y(o, this.toBBox), o;
|
|
6190
6190
|
}
|
|
6191
6191
|
_chooseSubtree(e, t, i, n) {
|
|
6192
6192
|
for (; n.push(t), !(t.leaf || n.length - 1 === i); ) {
|
|
6193
|
-
let s = 1 / 0,
|
|
6193
|
+
let s = 1 / 0, r = 1 / 0, o;
|
|
6194
6194
|
for (let a = 0; a < t.children.length; a++) {
|
|
6195
6195
|
const h = t.children[a], l = Le(h), m = fn(e, h) - l;
|
|
6196
|
-
m <
|
|
6196
|
+
m < r ? (r = m, s = l < s ? l : s, o = h) : m === r && l < s && (s = l, o = h);
|
|
6197
6197
|
}
|
|
6198
|
-
t =
|
|
6198
|
+
t = o || t.children[0];
|
|
6199
6199
|
}
|
|
6200
6200
|
return t;
|
|
6201
6201
|
}
|
|
6202
6202
|
_insert(e, t, i) {
|
|
6203
|
-
const n = i ? e : this.toBBox(e), s = [],
|
|
6204
|
-
for (
|
|
6203
|
+
const n = i ? e : this.toBBox(e), s = [], r = this._chooseSubtree(n, this.data, t, s);
|
|
6204
|
+
for (r.children.push(e), ce(r, n); t >= 0 && s[t].children.length > this._maxEntries; )
|
|
6205
6205
|
this._split(s, t), t--;
|
|
6206
6206
|
this._adjustParentBBoxes(n, s, t);
|
|
6207
6207
|
}
|
|
@@ -6209,37 +6209,37 @@ class mn {
|
|
|
6209
6209
|
_split(e, t) {
|
|
6210
6210
|
const i = e[t], n = i.children.length, s = this._minEntries;
|
|
6211
6211
|
this._chooseSplitAxis(i, s, n);
|
|
6212
|
-
const
|
|
6213
|
-
|
|
6212
|
+
const r = this._chooseSplitIndex(i, s, n), o = q(i.children.splice(r, i.children.length - r));
|
|
6213
|
+
o.height = i.height, o.leaf = i.leaf, Y(i, this.toBBox), Y(o, this.toBBox), t ? e[t - 1].children.push(o) : this._splitRoot(i, o);
|
|
6214
6214
|
}
|
|
6215
6215
|
_splitRoot(e, t) {
|
|
6216
6216
|
this.data = q([e, t]), this.data.height = e.height + 1, this.data.leaf = !1, Y(this.data, this.toBBox);
|
|
6217
6217
|
}
|
|
6218
6218
|
_chooseSplitIndex(e, t, i) {
|
|
6219
|
-
let n, s = 1 / 0,
|
|
6220
|
-
for (let
|
|
6221
|
-
const a = ae(e, 0,
|
|
6222
|
-
l < s ? (s = l, n =
|
|
6219
|
+
let n, s = 1 / 0, r = 1 / 0;
|
|
6220
|
+
for (let o = t; o <= i - t; o++) {
|
|
6221
|
+
const a = ae(e, 0, o, this.toBBox), h = ae(e, o, i, this.toBBox), l = xn(a, h), m = Le(a) + Le(h);
|
|
6222
|
+
l < s ? (s = l, n = o, r = m < r ? m : r) : l === s && m < r && (r = m, n = o);
|
|
6223
6223
|
}
|
|
6224
6224
|
return n || i - t;
|
|
6225
6225
|
}
|
|
6226
6226
|
// sorts node children by the best axis for split
|
|
6227
6227
|
_chooseSplitAxis(e, t, i) {
|
|
6228
|
-
const n = e.leaf ? this.compareMinX : pn, s = e.leaf ? this.compareMinY : yn,
|
|
6229
|
-
|
|
6228
|
+
const n = e.leaf ? this.compareMinX : pn, s = e.leaf ? this.compareMinY : yn, r = this._allDistMargin(e, t, i, n), o = this._allDistMargin(e, t, i, s);
|
|
6229
|
+
r < o && e.children.sort(n);
|
|
6230
6230
|
}
|
|
6231
6231
|
// total margin of all possible split distributions where each node is at least m full
|
|
6232
6232
|
_allDistMargin(e, t, i, n) {
|
|
6233
6233
|
e.children.sort(n);
|
|
6234
|
-
const s = this.toBBox,
|
|
6235
|
-
let a = xe(
|
|
6234
|
+
const s = this.toBBox, r = ae(e, 0, t, s), o = ae(e, i - t, i, s);
|
|
6235
|
+
let a = xe(r) + xe(o);
|
|
6236
6236
|
for (let h = t; h < i - t; h++) {
|
|
6237
6237
|
const l = e.children[h];
|
|
6238
|
-
ce(
|
|
6238
|
+
ce(r, e.leaf ? s(l) : l), a += xe(r);
|
|
6239
6239
|
}
|
|
6240
6240
|
for (let h = i - t - 1; h >= t; h--) {
|
|
6241
6241
|
const l = e.children[h];
|
|
6242
|
-
ce(
|
|
6242
|
+
ce(o, e.leaf ? s(l) : l), a += xe(o);
|
|
6243
6243
|
}
|
|
6244
6244
|
return a;
|
|
6245
6245
|
}
|
|
@@ -6264,8 +6264,8 @@ function Y(c, e) {
|
|
|
6264
6264
|
function ae(c, e, t, i, n) {
|
|
6265
6265
|
n || (n = q(null)), n.minX = 1 / 0, n.minY = 1 / 0, n.maxX = -1 / 0, n.maxY = -1 / 0;
|
|
6266
6266
|
for (let s = e; s < t; s++) {
|
|
6267
|
-
const
|
|
6268
|
-
ce(n, c.leaf ? i(
|
|
6267
|
+
const r = c.children[s];
|
|
6268
|
+
ce(n, c.leaf ? i(r) : r);
|
|
6269
6269
|
}
|
|
6270
6270
|
return n;
|
|
6271
6271
|
}
|
|
@@ -6312,8 +6312,8 @@ function Qe(c, e, t, i, n) {
|
|
|
6312
6312
|
const s = [e, t];
|
|
6313
6313
|
for (; s.length; ) {
|
|
6314
6314
|
if (t = s.pop(), e = s.pop(), t - e <= i) continue;
|
|
6315
|
-
const
|
|
6316
|
-
wt(c,
|
|
6315
|
+
const r = e + Math.ceil((t - e) / i / 2) * i;
|
|
6316
|
+
wt(c, r, e, t, n), s.push(e, r, r, t);
|
|
6317
6317
|
}
|
|
6318
6318
|
}
|
|
6319
6319
|
class _n {
|
|
@@ -6493,10 +6493,10 @@ class bn {
|
|
|
6493
6493
|
*/
|
|
6494
6494
|
get stats() {
|
|
6495
6495
|
const e = [];
|
|
6496
|
-
let t = 0, i = 0, n = 0, s = 0,
|
|
6497
|
-
return this._layers.forEach((
|
|
6498
|
-
const a =
|
|
6499
|
-
e.push(a), n += a.line.indexed.geometrySize + a.line.nonIndexed.geometrySize, s += a.mesh.indexed.geometrySize + a.mesh.nonIndexed.geometrySize,
|
|
6496
|
+
let t = 0, i = 0, n = 0, s = 0, r = 0;
|
|
6497
|
+
return this._layers.forEach((o) => {
|
|
6498
|
+
const a = o.stats;
|
|
6499
|
+
e.push(a), n += a.line.indexed.geometrySize + a.line.nonIndexed.geometrySize, s += a.mesh.indexed.geometrySize + a.mesh.nonIndexed.geometrySize, r += a.point.indexed.geometrySize + a.point.nonIndexed.geometrySize, t += a.summary.totalGeometrySize, i += a.summary.totalMappingSize;
|
|
6500
6500
|
}), {
|
|
6501
6501
|
layers: e,
|
|
6502
6502
|
summary: {
|
|
@@ -6504,7 +6504,7 @@ class bn {
|
|
|
6504
6504
|
totalSize: {
|
|
6505
6505
|
line: n,
|
|
6506
6506
|
mesh: s,
|
|
6507
|
-
point:
|
|
6507
|
+
point: r,
|
|
6508
6508
|
geometry: t,
|
|
6509
6509
|
mapping: i
|
|
6510
6510
|
}
|
|
@@ -7076,8 +7076,8 @@ class vn extends gi {
|
|
|
7076
7076
|
e == null && (e = this.curPos);
|
|
7077
7077
|
const t = [], i = this._scene.activeLayout;
|
|
7078
7078
|
if (i) {
|
|
7079
|
-
const n = this.activeLayoutView, s = n.pointToBox(e, this.selectionBoxSize),
|
|
7080
|
-
|
|
7079
|
+
const n = this.activeLayoutView, s = n.pointToBox(e, this.selectionBoxSize), r = this._scene.search(s), o = Math.max(s.size.width / 2, s.size.height / 2), a = n.resetRaycaster(e, o);
|
|
7080
|
+
r.forEach((h) => {
|
|
7081
7081
|
const l = h.id;
|
|
7082
7082
|
i.isIntersectWith(l, a) && t.push(l);
|
|
7083
7083
|
});
|
|
@@ -7109,7 +7109,9 @@ class vn extends gi {
|
|
|
7109
7109
|
*/
|
|
7110
7110
|
addEntity(e) {
|
|
7111
7111
|
const t = Array.isArray(e) ? e : [e];
|
|
7112
|
-
|
|
7112
|
+
setTimeout(async () => {
|
|
7113
|
+
await this.batchConvert(t);
|
|
7114
|
+
});
|
|
7113
7115
|
}
|
|
7114
7116
|
/**
|
|
7115
7117
|
* Remove the specified entity from this view.
|
|
@@ -7217,36 +7219,34 @@ class vn extends gi {
|
|
|
7217
7219
|
* @param entities - The database entities
|
|
7218
7220
|
* @returns The converted three entities
|
|
7219
7221
|
*/
|
|
7220
|
-
batchConvert(e) {
|
|
7221
|
-
|
|
7222
|
-
|
|
7223
|
-
const n = e[i], s = n.draw(
|
|
7222
|
+
async batchConvert(e) {
|
|
7223
|
+
for (let t = 0; t < e.length; ++t) {
|
|
7224
|
+
const i = e[t], n = i.draw(
|
|
7224
7225
|
this._renderer
|
|
7225
7226
|
);
|
|
7226
|
-
if (
|
|
7227
|
-
|
|
7228
|
-
const
|
|
7229
|
-
if (
|
|
7230
|
-
this._scene.addEntity(
|
|
7231
|
-
}),
|
|
7232
|
-
if (
|
|
7233
|
-
const r = this._layoutViewManager.getAt(
|
|
7227
|
+
if (n) {
|
|
7228
|
+
n.objectId = i.objectId, n.ownerId = i.ownerId, n.layerName = i.layer, n.visible = i.visibility;
|
|
7229
|
+
const s = !(i instanceof ot || i instanceof at);
|
|
7230
|
+
if (await n.draw().then(() => {
|
|
7231
|
+
this._scene.addEntity(n, s), n.dispose(), this._isDirty = !0;
|
|
7232
|
+
}), i instanceof st) {
|
|
7233
|
+
if (i.number > 1) {
|
|
7234
|
+
const r = this._layoutViewManager.getAt(i.ownerId);
|
|
7234
7235
|
if (r) {
|
|
7235
|
-
const
|
|
7236
|
+
const o = new Be(
|
|
7236
7237
|
r,
|
|
7237
|
-
|
|
7238
|
+
i.toGiViewport(),
|
|
7238
7239
|
this._renderer
|
|
7239
7240
|
);
|
|
7240
|
-
r.addViewport(
|
|
7241
|
+
r.addViewport(o);
|
|
7241
7242
|
}
|
|
7242
7243
|
}
|
|
7243
|
-
} else if (
|
|
7244
|
-
const r =
|
|
7245
|
-
r && this._missedImages.set(
|
|
7244
|
+
} else if (i instanceof rt) {
|
|
7245
|
+
const r = i.imageFileName;
|
|
7246
|
+
r && this._missedImages.set(i.objectId, r);
|
|
7246
7247
|
}
|
|
7247
7248
|
}
|
|
7248
7249
|
}
|
|
7249
|
-
return t;
|
|
7250
7250
|
}
|
|
7251
7251
|
}
|
|
7252
7252
|
const Je = "simsun";
|
|
@@ -7278,8 +7278,8 @@ class Q {
|
|
|
7278
7278
|
createExampleDoc1(e) {
|
|
7279
7279
|
for (let n = 0; n < 2; ++n)
|
|
7280
7280
|
for (let s = 0; s < 2; ++s) {
|
|
7281
|
-
const
|
|
7282
|
-
|
|
7281
|
+
const r = new De(), o = new ct();
|
|
7282
|
+
o.addVertexAt(0, { x: s * 100, y: n * 100, bulge: 1 }), o.addVertexAt(1, { x: s * 100 + 100, y: n * 100, bulge: 1 }), o.closed = !0, r.add(o), e.tables.blockTable.modelSpace.appendEntity(r);
|
|
7283
7283
|
}
|
|
7284
7284
|
}
|
|
7285
7285
|
/**
|
|
@@ -7466,8 +7466,8 @@ class Sn {
|
|
|
7466
7466
|
await this.getAvaiableFonts();
|
|
7467
7467
|
const t = [];
|
|
7468
7468
|
e.forEach((n) => {
|
|
7469
|
-
const s = n.toLowerCase(),
|
|
7470
|
-
|
|
7469
|
+
const s = n.toLowerCase(), r = Jt(this._avaiableFonts, (o) => Kt(o.name, (a) => a.toLowerCase() == s) >= 0);
|
|
7470
|
+
r && t.push(r.url);
|
|
7471
7471
|
}), (await this._cadRenderer.loadFonts(t)).forEach((n) => {
|
|
7472
7472
|
n.status || V.emit("font-not-loaded", {
|
|
7473
7473
|
fontName: n.fontName,
|
|
@@ -7931,23 +7931,23 @@ class Ke {
|
|
|
7931
7931
|
});
|
|
7932
7932
|
}), i.hatchStyle = e.hatchStyle, i.patternName = e.patternName, i.patternType = e.patternType, i.patternAngle = e.patternAngle == null ? 0 : e.patternAngle, i.patternScale = e.patternScale == null ? 0 : e.patternScale, e.boundaryPaths.forEach((n) => {
|
|
7933
7933
|
if (n.boundaryPathTypeFlag & 2) {
|
|
7934
|
-
const s = n,
|
|
7935
|
-
|
|
7936
|
-
|
|
7937
|
-
x:
|
|
7938
|
-
y:
|
|
7939
|
-
bulge:
|
|
7934
|
+
const s = n, r = new ct();
|
|
7935
|
+
r.closed = s.isClosed, s.vertices.forEach((o, a) => {
|
|
7936
|
+
r.addVertexAt(a, {
|
|
7937
|
+
x: o.x,
|
|
7938
|
+
y: o.y,
|
|
7939
|
+
bulge: o.bulge
|
|
7940
7940
|
});
|
|
7941
|
-
}), i.add(
|
|
7941
|
+
}), i.add(r);
|
|
7942
7942
|
} else {
|
|
7943
|
-
const s = n,
|
|
7944
|
-
s.edges.forEach((
|
|
7945
|
-
if (
|
|
7946
|
-
const a =
|
|
7947
|
-
|
|
7948
|
-
} else if (
|
|
7949
|
-
const a =
|
|
7950
|
-
|
|
7943
|
+
const s = n, r = new ut();
|
|
7944
|
+
s.edges.forEach((o) => {
|
|
7945
|
+
if (o.type == 1) {
|
|
7946
|
+
const a = o;
|
|
7947
|
+
r.add(new gt(a.start, a.end));
|
|
7948
|
+
} else if (o.type == 2) {
|
|
7949
|
+
const a = o;
|
|
7950
|
+
r.add(
|
|
7951
7951
|
new mt(
|
|
7952
7952
|
a.center,
|
|
7953
7953
|
a.radius,
|
|
@@ -7956,15 +7956,15 @@ class Ke {
|
|
|
7956
7956
|
!a.isCCW
|
|
7957
7957
|
)
|
|
7958
7958
|
);
|
|
7959
|
-
} else if (
|
|
7960
|
-
const a =
|
|
7959
|
+
} else if (o.type == 3) {
|
|
7960
|
+
const a = o;
|
|
7961
7961
|
new Te().subVectors(a.end, a.center);
|
|
7962
7962
|
const h = Math.sqrt(
|
|
7963
7963
|
Math.pow(a.end.x, 2) + Math.pow(a.end.y, 2)
|
|
7964
7964
|
), l = h * a.lengthOfMinorAxis;
|
|
7965
7965
|
let m = a.startAngle, u = a.endAngle;
|
|
7966
7966
|
const p = Math.atan2(a.end.y, a.end.x);
|
|
7967
|
-
a.isCCW || (m = Math.PI * 2 - m, u = Math.PI * 2 - u),
|
|
7967
|
+
a.isCCW || (m = Math.PI * 2 - m, u = Math.PI * 2 - u), r.add(
|
|
7968
7968
|
new jt(
|
|
7969
7969
|
{ ...a.center, z: 0 },
|
|
7970
7970
|
h,
|
|
@@ -7975,8 +7975,8 @@ class Ke {
|
|
|
7975
7975
|
p
|
|
7976
7976
|
)
|
|
7977
7977
|
);
|
|
7978
|
-
} else if (
|
|
7979
|
-
const a =
|
|
7978
|
+
} else if (o.type == 4) {
|
|
7979
|
+
const a = o;
|
|
7980
7980
|
if (a.numberOfControlPoints > 0 && a.numberOfKnots > 0) {
|
|
7981
7981
|
const h = a.controlPoints.map(
|
|
7982
7982
|
(u) => ({
|
|
@@ -7987,7 +7987,7 @@ class Ke {
|
|
|
7987
7987
|
);
|
|
7988
7988
|
let l = !0;
|
|
7989
7989
|
const m = a.controlPoints.map((u) => (u.weight == null && (l = !1), u.weight || 1));
|
|
7990
|
-
|
|
7990
|
+
r.add(
|
|
7991
7991
|
new Fe(
|
|
7992
7992
|
h,
|
|
7993
7993
|
a.knots,
|
|
@@ -8000,10 +8000,10 @@ class Ke {
|
|
|
8000
8000
|
y: l.y,
|
|
8001
8001
|
z: 0
|
|
8002
8002
|
}));
|
|
8003
|
-
|
|
8003
|
+
r.add(new Fe(h, "Uniform"));
|
|
8004
8004
|
}
|
|
8005
8005
|
}
|
|
8006
|
-
}), i.add(
|
|
8006
|
+
}), i.add(r);
|
|
8007
8007
|
}
|
|
8008
8008
|
}), i;
|
|
8009
8009
|
}
|
|
@@ -8137,19 +8137,19 @@ class In extends Bt {
|
|
|
8137
8137
|
*/
|
|
8138
8138
|
getFonts(e) {
|
|
8139
8139
|
const t = /* @__PURE__ */ new Map();
|
|
8140
|
-
e.tables.BLOCK_RECORD.entries.forEach((
|
|
8141
|
-
t.set(
|
|
8140
|
+
e.tables.BLOCK_RECORD.entries.forEach((r) => {
|
|
8141
|
+
t.set(r.name, r);
|
|
8142
8142
|
});
|
|
8143
|
-
const i = /* @__PURE__ */ new Map(), n = (
|
|
8144
|
-
if (
|
|
8145
|
-
const
|
|
8146
|
-
return
|
|
8143
|
+
const i = /* @__PURE__ */ new Map(), n = (r) => {
|
|
8144
|
+
if (r) {
|
|
8145
|
+
const o = r.lastIndexOf(".");
|
|
8146
|
+
return o >= 0 ? r.substring(0, o).toLowerCase() : r.toLowerCase();
|
|
8147
8147
|
}
|
|
8148
8148
|
};
|
|
8149
|
-
e.tables.STYLE.entries.forEach((
|
|
8150
|
-
const
|
|
8151
|
-
let a = n(
|
|
8152
|
-
a &&
|
|
8149
|
+
e.tables.STYLE.entries.forEach((r) => {
|
|
8150
|
+
const o = [];
|
|
8151
|
+
let a = n(r.font);
|
|
8152
|
+
a && o.push(a), a = n(r.bigFont), a && o.push(a), i.set(r.name, o);
|
|
8153
8153
|
});
|
|
8154
8154
|
const s = /* @__PURE__ */ new Set();
|
|
8155
8155
|
return this.getFontsInBlock(e.entities, t, i, s), Array.from(s);
|
|
@@ -8159,19 +8159,19 @@ class In extends Bt {
|
|
|
8159
8159
|
*/
|
|
8160
8160
|
getFontsInBlock(e, t, i, n) {
|
|
8161
8161
|
const s = /\\f(.*?)\|/g;
|
|
8162
|
-
e.forEach((
|
|
8163
|
-
if (
|
|
8164
|
-
const
|
|
8165
|
-
[...
|
|
8162
|
+
e.forEach((r) => {
|
|
8163
|
+
if (r.type == "MTEXT") {
|
|
8164
|
+
const o = r;
|
|
8165
|
+
[...o.text.matchAll(s)].forEach((h) => {
|
|
8166
8166
|
n.add(h[1].toLowerCase());
|
|
8167
8167
|
});
|
|
8168
|
-
const a = i.get(
|
|
8168
|
+
const a = i.get(o.styleName);
|
|
8169
8169
|
a == null || a.forEach((h) => n.add(h));
|
|
8170
|
-
} else if (
|
|
8171
|
-
const
|
|
8170
|
+
} else if (r.type == "TEXT") {
|
|
8171
|
+
const o = r, a = i.get(o.styleName);
|
|
8172
8172
|
a == null || a.forEach((h) => n.add(h));
|
|
8173
|
-
} else if (
|
|
8174
|
-
const
|
|
8173
|
+
} else if (r.type == "INSERT") {
|
|
8174
|
+
const o = r, a = t.get(o.name);
|
|
8175
8175
|
a && this.getFontsInBlock(a.entities, t, i, n);
|
|
8176
8176
|
}
|
|
8177
8177
|
});
|
|
@@ -8306,8 +8306,8 @@ class In extends Bt {
|
|
|
8306
8306
|
}
|
|
8307
8307
|
async processEntitiesInBlock(e, t) {
|
|
8308
8308
|
const i = new Ke(), n = e.length, s = [];
|
|
8309
|
-
for (let
|
|
8310
|
-
const
|
|
8309
|
+
for (let r = 0; r < n; r++) {
|
|
8310
|
+
const o = e[r], a = i.convert(o);
|
|
8311
8311
|
a && s.push(a);
|
|
8312
8312
|
}
|
|
8313
8313
|
t.appendEntity(s);
|
|
@@ -8318,19 +8318,19 @@ class In extends Bt {
|
|
|
8318
8318
|
* smaller pieces and executed in small intervals to allow the UI to remain responsive.
|
|
8319
8319
|
*/
|
|
8320
8320
|
async processEntities(e, t, i, n, s) {
|
|
8321
|
-
const
|
|
8322
|
-
let
|
|
8323
|
-
const a =
|
|
8321
|
+
const r = new Ke();
|
|
8322
|
+
let o = e.entities;
|
|
8323
|
+
const a = o.length, h = new Dt(
|
|
8324
8324
|
a,
|
|
8325
8325
|
100 - n.value,
|
|
8326
8326
|
i
|
|
8327
8327
|
);
|
|
8328
|
-
this.config.convertByEntityType && (
|
|
8328
|
+
this.config.convertByEntityType && (o = this.groupAndFlattenByType(o));
|
|
8329
8329
|
const l = t.tables.blockTable.modelSpace;
|
|
8330
8330
|
await h.processChunk(async (m, u) => {
|
|
8331
8331
|
const p = [];
|
|
8332
8332
|
for (let g = m; g < u; g++) {
|
|
8333
|
-
const y =
|
|
8333
|
+
const y = o[g], f = r.convert(y);
|
|
8334
8334
|
f && p.push(f);
|
|
8335
8335
|
}
|
|
8336
8336
|
if (l.appendEntity(p), s) {
|
|
@@ -8354,11 +8354,11 @@ class In extends Bt {
|
|
|
8354
8354
|
e.objects.LAYOUT.forEach((n) => {
|
|
8355
8355
|
const s = new tt();
|
|
8356
8356
|
s.layoutName = n.layoutName, s.tabOrder = n.tabOrder;
|
|
8357
|
-
const
|
|
8357
|
+
const r = t.tables.blockTable.newIterator();
|
|
8358
8358
|
s.objectId = n.handle.toString();
|
|
8359
|
-
for (const
|
|
8360
|
-
if (
|
|
8361
|
-
s.blockTableRecordId =
|
|
8359
|
+
for (const o of r)
|
|
8360
|
+
if (o.layoutId === s.objectId) {
|
|
8361
|
+
s.blockTableRecordId = o.objectId;
|
|
8362
8362
|
break;
|
|
8363
8363
|
}
|
|
8364
8364
|
s.limits.min.copy(n.minLimit), s.limits.max.copy(n.maxLimit), s.extents.min.copy(n.minExtent), s.extents.max.copy(n.maxExtent), this.processCommonObjectAttrs(n, s), i.setAt(s.layoutName, s);
|