gl-draw 0.17.0-beta.4 → 0.17.0-beta.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/cartographicToCartesian.js +1 -0
  2. package/dist/cartographicToCartesian.module.js +49 -0
  3. package/dist/constants.d.ts +0 -1
  4. package/dist/core/BaseObject/PointerEvent.d.ts +1 -0
  5. package/dist/core/BaseObject/index.d.ts +16 -4
  6. package/dist/core/Composer.d.ts +5 -5
  7. package/dist/core/Helper.d.ts +4 -4
  8. package/dist/core/Lead/Pick.d.ts +35 -3
  9. package/dist/core/Lead/index.d.ts +5 -6
  10. package/dist/core/Pages/Pages.d.ts +1 -0
  11. package/dist/core/Pencil.d.ts +3 -3
  12. package/dist/core/pass/OutputPass.d.ts +1 -2
  13. package/dist/index.js +2 -2
  14. package/dist/index.module.js +505 -411
  15. package/dist/index.module2.js +1180 -0
  16. package/dist/index2.js +140 -0
  17. package/dist/objects/conicPolygon/geometry/index.d.ts +1 -2
  18. package/dist/objects/ellipsoid/createGeometry.d.ts +30 -0
  19. package/dist/objects/ellipsoid/index.d.ts +38 -0
  20. package/dist/objects/extrudePolygon/createGeometry.d.ts +2 -1
  21. package/dist/objects/group/index.d.ts +1 -0
  22. package/dist/objects/index.d.ts +2 -0
  23. package/dist/objects/index.js +1 -1
  24. package/dist/objects/index.module.js +907 -763
  25. package/dist/objects/node/CollisionManager.d.ts +94 -0
  26. package/dist/objects/node/index.d.ts +7 -2
  27. package/dist/objects/pie/index.d.ts +2 -1
  28. package/dist/plugins/Worker/getAttributes/conicLine.d.ts +1 -1
  29. package/dist/plugins/Worker/getAttributes/conicPolygon.d.ts +2 -3
  30. package/dist/plugins/Worker/getAttributes/extrudePolygon.d.ts +1 -1
  31. package/dist/plugins/Worker/getAttributes/getCoordinatesArr.d.ts +5 -1
  32. package/dist/plugins/Worker/getAttributes/line.d.ts +1 -1
  33. package/dist/plugins/Worker/getAttributes/line2.d.ts +1 -1
  34. package/dist/plugins/Worker/getAttributes/splitPolygonsByLongitudeDifference.d.ts +5 -2
  35. package/dist/plugins/Worker/index.d.ts +2 -3
  36. package/dist/plugins/index.js +1 -1
  37. package/dist/plugins/index.module.js +77 -70
  38. package/dist/utils/Sprite2Points.d.ts +1 -1
  39. package/dist/utils/cartographicToCartesian.d.ts +30 -0
  40. package/dist/utils/index.d.ts +1 -1
  41. package/dist/utils/index.js +1 -1
  42. package/dist/utils/index.module.js +15 -13
  43. package/dist/utils/proposedRaycast.d.ts +1 -0
  44. package/package.json +1 -1
  45. package/dist/WebGPULineSegments2.js +0 -140
  46. package/dist/WebGPULineSegments2.module.js +0 -1031
  47. package/dist/polar2Cartesian.js +0 -1
  48. package/dist/polar2Cartesian.module.js +0 -18
  49. package/dist/utils/polar2Cartesian.d.ts +0 -1
@@ -1,450 +1,492 @@
1
- var Je = Object.defineProperty, Qe = Object.defineProperties;
2
- var Ke = Object.getOwnPropertyDescriptors;
3
- var he = Object.getOwnPropertySymbols;
4
- var Be = Object.prototype.hasOwnProperty, Oe = Object.prototype.propertyIsEnumerable;
5
- var Ie = (p, e, t) => e in p ? Je(p, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : p[e] = t, z = (p, e) => {
6
- for (var t in e || (e = {}))
7
- Be.call(e, t) && Ie(p, t, e[t]);
8
- if (he)
9
- for (var t of he(e))
10
- Oe.call(e, t) && Ie(p, t, e[t]);
11
- return p;
12
- }, ue = (p, e) => Qe(p, Ke(e));
13
- var ye = (p, e) => {
14
- var t = {};
15
- for (var n in p)
16
- Be.call(p, n) && e.indexOf(n) < 0 && (t[n] = p[n]);
17
- if (p != null && he)
18
- for (var n of he(p))
19
- e.indexOf(n) < 0 && Oe.call(p, n) && (t[n] = p[n]);
20
- return t;
1
+ var te = Object.defineProperty, ee = Object.defineProperties;
2
+ var se = Object.getOwnPropertyDescriptors;
3
+ var pt = Object.getOwnPropertySymbols;
4
+ var Rt = Object.prototype.hasOwnProperty, Vt = Object.prototype.propertyIsEnumerable;
5
+ var Bt = (f, t, e) => t in f ? te(f, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : f[t] = e, O = (f, t) => {
6
+ for (var e in t || (t = {}))
7
+ Rt.call(t, e) && Bt(f, e, t[e]);
8
+ if (pt)
9
+ for (var e of pt(t))
10
+ Vt.call(t, e) && Bt(f, e, t[e]);
11
+ return f;
12
+ }, gt = (f, t) => ee(f, se(t));
13
+ var xt = (f, t) => {
14
+ var e = {};
15
+ for (var s in f)
16
+ Rt.call(f, s) && t.indexOf(s) < 0 && (e[s] = f[s]);
17
+ if (f != null && pt)
18
+ for (var s of pt(f))
19
+ t.indexOf(s) < 0 && Vt.call(f, s) && (e[s] = f[s]);
20
+ return e;
21
21
  };
22
- var oe = (p, e, t) => new Promise((n, s) => {
23
- var o = (r) => {
22
+ var ct = (f, t, e) => new Promise((s, n) => {
23
+ var r = (o) => {
24
24
  try {
25
- f(t.next(r));
25
+ c(e.next(o));
26
26
  } catch (h) {
27
- s(h);
27
+ n(h);
28
28
  }
29
- }, a = (r) => {
29
+ }, a = (o) => {
30
30
  try {
31
- f(t.throw(r));
31
+ c(e.throw(o));
32
32
  } catch (h) {
33
- s(h);
33
+ n(h);
34
34
  }
35
- }, f = (r) => r.done ? n(r.value) : Promise.resolve(r.value).then(o, a);
36
- f((t = t.apply(p, e)).next());
35
+ }, c = (o) => o.done ? s(o.value) : Promise.resolve(o.value).then(r, a);
36
+ c((e = e.apply(f, t)).next());
37
37
  });
38
- import { LineMaterial as et } from "three/examples/jsm/lines/LineMaterial";
39
- import { LineMaterial as un } from "three/examples/jsm/lines/LineMaterial";
40
- import { LineSegmentsGeometry as tt } from "three/examples/jsm/lines/LineSegmentsGeometry";
41
- import { LineSegmentsGeometry as dn } from "three/examples/jsm/lines/LineSegmentsGeometry";
42
- import { P as nt, a as Z, M as st, L as it } from "../WebGPULineSegments2.module.js";
43
- import { g as pn } from "../WebGPULineSegments2.module.js";
44
- import { BufferGeometry as me, Float32BufferAttribute as xe, Vector3 as _, ShapeUtils as fe, Shape as we, Vector2 as P, ArcCurve as ot, CatmullRomCurve3 as rt, CubicBezierCurve as at, CubicBezierCurve3 as ct, EllipseCurve as lt, LineCurve as ht, LineCurve3 as ut, QuadraticBezierCurve as ft, QuadraticBezierCurve3 as dt, SplineCurve as mt, Box3 as pt, PlaneGeometry as gt, CanvasTexture as yt, AmbientLight as bt, DirectionalLight as xt, PointLight as wt, SpotLight as vt, HemisphereLight as St, RectAreaLight as At, Matrix4 as Ne, BufferAttribute as Y, Ray as Mt, Sphere as Lt, LineSegments as We, Color as ke, MeshBasicMaterial as Tt, Mesh as Et } from "three";
45
- import { mergeAttributes as Re, mergeGroups as Gt } from "three/examples/jsm/utils/BufferGeometryUtils";
46
- import { g as Pt, c as Ct } from "../uvGenerator.module.js";
47
- import { Brush as Ue, Evaluator as _t, INTERSECTION as zt } from "three-bvh-csg";
48
- import { RectAreaLightUniformsLib as jt } from "three/examples/jsm/lights/RectAreaLightUniformsLib";
49
- import * as ne from "@tweenjs/tween.js";
50
- import { LineSegments2 as It } from "three/examples/jsm/lines/LineSegments2";
51
- function V(p, e = 0) {
52
- const t = p[0].index !== null, n = new Set(Object.keys(p[0].attributes)), s = new Set(
53
- Object.keys(p[0].morphAttributes)
54
- ), o = {}, a = {}, f = p[0].morphTargetsRelative, r = new me();
38
+ import { LineMaterial as ne } from "three/examples/jsm/lines/LineMaterial";
39
+ import { LineMaterial as ps } from "three/examples/jsm/lines/LineMaterial";
40
+ import { LineSegmentsGeometry as ie } from "three/examples/jsm/lines/LineSegmentsGeometry";
41
+ import { LineSegmentsGeometry as ys } from "three/examples/jsm/lines/LineSegmentsGeometry";
42
+ import { P as oe, a as K, M as re, L as ae } from "../index.module2.js";
43
+ import { N as ws, g as xs } from "../index.module2.js";
44
+ import { BufferGeometry as lt, Float32BufferAttribute as rt, MeshStandardMaterial as ce, Mesh as kt, Vector3 as z, ShapeUtils as yt, Shape as St, Vector2 as P, ArcCurve as le, CatmullRomCurve3 as he, CubicBezierCurve as ue, CubicBezierCurve3 as de, EllipseCurve as fe, LineCurve as me, LineCurve3 as pe, QuadraticBezierCurve as ge, QuadraticBezierCurve3 as ye, SplineCurve as be, Box3 as we, PlaneGeometry as xe, CanvasTexture as ve, AmbientLight as Me, DirectionalLight as Se, PointLight as Ae, SpotLight as Le, HemisphereLight as Te, RectAreaLight as Ce, Matrix4 as Ft, BufferAttribute as Q, Ray as Ee, Sphere as Ge, LineSegments as qt, Color as Yt, MeshBasicMaterial as _e } from "three";
45
+ import { mergeAttributes as Ot, mergeGroups as Pe } from "three/examples/jsm/utils/BufferGeometryUtils";
46
+ import { W as vt } from "../cartographicToCartesian.module.js";
47
+ import { g as ze, c as je } from "../uvGenerator.module.js";
48
+ import { Brush as Dt, Evaluator as Ie, INTERSECTION as Ue } from "three-bvh-csg";
49
+ import { RectAreaLightUniformsLib as Be } from "three/examples/jsm/lights/RectAreaLightUniformsLib";
50
+ import * as ot from "@tweenjs/tween.js";
51
+ import { LineSegments2 as Re } from "three/examples/jsm/lines/LineSegments2";
52
+ function F(f, t = 0) {
53
+ const e = f[0].index !== null, s = new Set(Object.keys(f[0].attributes)), n = new Set(
54
+ Object.keys(f[0].morphAttributes)
55
+ ), r = {}, a = {}, c = f[0].morphTargetsRelative, o = new lt();
55
56
  let h = 0;
56
- for (let i = 0; i < p.length; ++i) {
57
- const c = p[i];
57
+ for (let i = 0; i < f.length; ++i) {
58
+ const l = f[i];
58
59
  let g = 0;
59
- if (t !== (c.index !== null))
60
+ if (e !== (l.index !== null))
60
61
  return console.error(
61
62
  "THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + i + ". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."
62
63
  ), null;
63
- for (const u in c.attributes) {
64
- if (!n.has(u))
64
+ for (const d in l.attributes) {
65
+ if (!s.has(d))
65
66
  return console.error(
66
- "THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + i + '. All geometries must have compatible attributes; make sure "' + u + '" attribute exists among all geometries, or in none of them.'
67
+ "THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + i + '. All geometries must have compatible attributes; make sure "' + d + '" attribute exists among all geometries, or in none of them.'
67
68
  ), null;
68
- o[u] === void 0 && (o[u] = []), o[u].push(c.attributes[u]), g++;
69
+ r[d] === void 0 && (r[d] = []), r[d].push(l.attributes[d]), g++;
69
70
  }
70
- if (g !== n.size)
71
+ if (g !== s.size)
71
72
  return console.error(
72
73
  "THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + i + ". Make sure all geometries have the same number of attributes."
73
74
  ), null;
74
- if (f !== c.morphTargetsRelative)
75
+ if (c !== l.morphTargetsRelative)
75
76
  return console.error(
76
77
  "THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + i + ". .morphTargetsRelative must be consistent throughout all geometries."
77
78
  ), null;
78
- for (const u in c.morphAttributes) {
79
- if (!s.has(u))
79
+ for (const d in l.morphAttributes) {
80
+ if (!n.has(d))
80
81
  return console.error(
81
82
  "THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + i + ". .morphAttributes must be consistent throughout all geometries."
82
83
  ), null;
83
- a[u] === void 0 && (a[u] = []), a[u].push(c.morphAttributes[u]);
84
+ a[d] === void 0 && (a[d] = []), a[d].push(l.morphAttributes[d]);
84
85
  }
85
- if (e) {
86
- let u;
87
- if (t)
88
- u = c.index.count;
89
- else if (c.attributes.position !== void 0)
90
- u = c.attributes.position.count;
86
+ if (t) {
87
+ let d;
88
+ if (e)
89
+ d = l.index.count;
90
+ else if (l.attributes.position !== void 0)
91
+ d = l.attributes.position.count;
91
92
  else
92
93
  return console.error(
93
94
  "THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + i + ". The geometry must have either an index or a position attribute"
94
95
  ), null;
95
- if (e === 1)
96
- r.addGroup(h, u, i);
97
- else if (e === 2 && c.groups.length > 0)
98
- for (let y of c.groups) {
99
- let L = y.materialIndex;
100
- r.addGroup(
96
+ if (t === 1)
97
+ o.addGroup(h, d, i);
98
+ else if (t === 2 && l.groups.length > 0)
99
+ for (let y of l.groups) {
100
+ let A = y.materialIndex;
101
+ o.addGroup(
101
102
  h + y.start,
102
- Math.min(y.count, u),
103
- L
103
+ Math.min(y.count, d),
104
+ A
104
105
  );
105
106
  }
106
- h += u;
107
+ h += d;
107
108
  }
108
109
  }
109
- if (t) {
110
+ if (e) {
110
111
  let i = 0;
111
- const c = [];
112
- for (let g = 0; g < p.length; ++g) {
113
- const u = p[g].index;
114
- for (let y = 0; y < u.count; ++y)
115
- c.push(u.getX(y) + i);
116
- i += p[g].attributes.position.count;
112
+ const l = [];
113
+ for (let g = 0; g < f.length; ++g) {
114
+ const d = f[g].index;
115
+ for (let y = 0; y < d.count; ++y)
116
+ l.push(d.getX(y) + i);
117
+ i += f[g].attributes.position.count;
117
118
  }
118
- r.setIndex(c);
119
+ o.setIndex(l);
119
120
  }
120
- for (const i in o) {
121
- const c = Re(o[i]);
122
- if (!c)
121
+ for (const i in r) {
122
+ const l = Ot(r[i]);
123
+ if (!l)
123
124
  return console.error(
124
125
  "THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the " + i + " attribute."
125
126
  ), null;
126
- r.setAttribute(i, c);
127
+ o.setAttribute(i, l);
127
128
  }
128
129
  for (const i in a) {
129
- const c = a[i][0].length;
130
- if (c === 0) break;
131
- r.morphAttributes = r.morphAttributes || {}, r.morphAttributes[i] = [];
132
- for (let g = 0; g < c; ++g) {
133
- const u = [];
134
- for (let L = 0; L < a[i].length; ++L)
135
- u.push(a[i][L][g]);
136
- const y = Re(u);
130
+ const l = a[i][0].length;
131
+ if (l === 0) break;
132
+ o.morphAttributes = o.morphAttributes || {}, o.morphAttributes[i] = [];
133
+ for (let g = 0; g < l; ++g) {
134
+ const d = [];
135
+ for (let A = 0; A < a[i].length; ++A)
136
+ d.push(a[i][A][g]);
137
+ const y = Ot(d);
137
138
  if (!y)
138
139
  return console.error(
139
140
  "THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the " + i + " morphAttribute."
140
141
  ), null;
141
- r.morphAttributes[i].push(y);
142
+ o.morphAttributes[i].push(y);
142
143
  }
143
144
  }
144
- return e === 2 ? Gt(r) : r;
145
+ return t === 2 ? Pe(o) : o;
145
146
  }
146
- const De = (p) => {
147
- const f = p, { coordinate: e, startHeight: t, height: n } = f, s = ye(f, ["coordinate", "startHeight", "height"]);
148
- let o = t || 0;
149
- return typeof t != "undefined" && typeof n != "undefined" && (o = t + n), new nt([e], ue(z({}, s), {
150
- startHeight: t,
151
- endHeight: o
147
+ const Ht = (f) => {
148
+ const c = f, { coordinate: t, startHeight: e, height: s } = c, n = xt(c, ["coordinate", "startHeight", "height"]);
149
+ let r = e || 0;
150
+ return typeof e != "undefined" && typeof s != "undefined" && (r = e + s), new oe([t], gt(O({}, n), {
151
+ startHeight: e,
152
+ endHeight: r
152
153
  }));
153
154
  };
154
- class Jt extends Z {
155
- constructor(e) {
156
- super(), this.options = z({}, e);
155
+ class es extends K {
156
+ constructor(t) {
157
+ super(), this.options = O({}, t);
157
158
  }
158
159
  create() {
159
- const r = this.options, {
160
- geometry: e,
161
- coordinateArr: t,
162
- coordinate: n,
163
- material: s,
164
- useGroups: o
165
- } = r, a = ye(r, [
160
+ const o = this.options, {
161
+ geometry: t,
162
+ coordinateArr: e,
163
+ coordinate: s,
164
+ material: n,
165
+ useGroups: r
166
+ } = o, a = xt(o, [
166
167
  "geometry",
167
168
  "coordinateArr",
168
169
  "coordinate",
169
170
  "material",
170
171
  "useGroups"
171
172
  ]);
172
- let f = e;
173
- if (!f && n)
174
- f = De(z({
175
- coordinate: n
173
+ let c = t;
174
+ if (!c && s)
175
+ c = Ht(O({
176
+ coordinate: s
176
177
  }, a));
177
- else if (!f && t) {
178
- const h = t.map(
179
- (i) => De(z({
178
+ else if (!c && e) {
179
+ const h = e.map(
180
+ (i) => Ht(O({
180
181
  coordinate: i
181
182
  }, a))
182
183
  );
183
- f = V(h, o != null ? o : 0);
184
+ c = F(h, r != null ? r : 0);
184
185
  }
185
- this.createMesh(f, s);
186
+ this.createMesh(c, n);
186
187
  }
187
188
  }
188
- const Bt = {
189
- ArcCurve: ot,
190
- CatmullRomCurve3: rt,
191
- CubicBezierCurve: at,
192
- CubicBezierCurve3: ct,
193
- EllipseCurve: lt,
194
- LineCurve: ht,
195
- LineCurve3: ut,
196
- QuadraticBezierCurve: ft,
197
- QuadraticBezierCurve3: dt,
198
- SplineCurve: mt
189
+ function Ve(f = {}) {
190
+ const {
191
+ a: t = vt.a,
192
+ b: e = vt.b,
193
+ scaleFactor: s = 1 / vt.a,
194
+ widthSegments: n = 64,
195
+ heightSegments: r = 32
196
+ } = f, a = new lt(), c = [], o = [], h = [], i = [], l = t * t, g = e * e, d = (l - g) / l;
197
+ let y = 0;
198
+ const A = [];
199
+ for (let x = 0; x <= r; x++) {
200
+ const v = [], E = x / r, _ = (0.5 - E) * 180 * Math.PI / 180, R = Math.sin(_), V = Math.cos(_), X = t / Math.sqrt(1 - d * R * R);
201
+ for (let j = 0; j <= n; j++) {
202
+ const $ = j / n, N = ($ - 0.5) * 360 * Math.PI / 180, at = Math.sin(N), I = Math.cos(N), U = X * V * at * s, At = X * (1 - d) * R * s, ht = X * V * I * s;
203
+ o.push(U, At, ht);
204
+ const tt = V * at / t, B = R * (1 - d) / e, k = V * I / t, D = Math.sqrt(tt * tt + B * B + k * k);
205
+ h.push(tt / D, B / D, k / D), i.push($, 1 - E), v.push(y++);
206
+ }
207
+ A.push(v);
208
+ }
209
+ for (let x = 0; x < r; x++)
210
+ for (let v = 0; v < n; v++) {
211
+ const E = A[x][v + 1], M = A[x][v], _ = A[x + 1][v], R = A[x + 1][v + 1];
212
+ c.push(E, M, R), c.push(M, _, R);
213
+ }
214
+ return a.setIndex(c), a.setAttribute("position", new rt(o, 3)), a.setAttribute("normal", new rt(h, 3)), a.setAttribute("uv", new rt(i, 2)), a;
215
+ }
216
+ class ss extends K {
217
+ constructor(t = {}) {
218
+ super(), this.options = t;
219
+ }
220
+ create() {
221
+ const t = Ve(this.options), e = this.options.material || new ce({
222
+ color: 2200782,
223
+ metalness: 0.1,
224
+ roughness: 0.7,
225
+ wireframe: !1
226
+ }), s = new kt(t, e);
227
+ return s.name = "Ellipsoid", this.object3d = s, s;
228
+ }
229
+ }
230
+ const Oe = {
231
+ ArcCurve: le,
232
+ CatmullRomCurve3: he,
233
+ CubicBezierCurve: ue,
234
+ CubicBezierCurve3: de,
235
+ EllipseCurve: fe,
236
+ LineCurve: me,
237
+ LineCurve3: pe,
238
+ QuadraticBezierCurve: ge,
239
+ QuadraticBezierCurve3: ye,
240
+ SplineCurve: be
199
241
  };
200
- class K extends me {
242
+ class nt extends lt {
201
243
  /**
202
244
  * Constructs a new extrude geometry.
203
245
  *
204
246
  * @param {Shape|Array<Shape>} [shapes] - A shape or an array of shapes.
205
247
  * @param {ExtrudeGeometry~Options} [options] - The extrude settings.
206
248
  */
207
- constructor(e = new we([
249
+ constructor(t = new St([
208
250
  new P(0.5, 0.5),
209
251
  new P(-0.5, 0.5),
210
252
  new P(-0.5, -0.5),
211
253
  new P(0.5, -0.5)
212
- ]), t = {}) {
254
+ ]), e = {}) {
213
255
  super(), this.type = "ExtrudeGeometry", this.parameters = {
214
- shapes: e,
215
- options: t
216
- }, e = Array.isArray(e) ? e : [e];
217
- const n = this, s = [], o = [];
218
- for (let f = 0, r = e.length; f < r; f++) {
219
- const h = e[f];
256
+ shapes: t,
257
+ options: e
258
+ }, t = Array.isArray(t) ? t : [t];
259
+ const s = this, n = [], r = [];
260
+ for (let c = 0, o = t.length; c < o; c++) {
261
+ const h = t[c];
220
262
  a(h);
221
263
  }
222
- this.setAttribute("position", new xe(s, 3)), this.setAttribute("uv", new xe(o, 2)), this.computeVertexNormals();
223
- function a(f) {
224
- var Te, Ee, Ge;
225
- const r = [], h = t.curveSegments !== void 0 ? t.curveSegments : 12, i = t.steps !== void 0 ? t.steps : 1, c = t.depth !== void 0 ? t.depth : 1;
226
- let g = t.bevelEnabled !== void 0 ? t.bevelEnabled : !0, u = t.bevelThickness !== void 0 ? t.bevelThickness : 0.2, y = t.bevelSize !== void 0 ? t.bevelSize : u - 0.1, L = t.bevelOffset !== void 0 ? t.bevelOffset : 0, S = t.bevelSegments !== void 0 ? t.bevelSegments : 3;
227
- const A = t.extrudePath, C = t.UVGenerator !== void 0 ? t.UVGenerator : Ot, v = (Te = t.hasTop) != null ? Te : !0, j = (Ee = t.hasBottom) != null ? Ee : !0, ee = (Ge = t.hasSide) != null ? Ge : !0;
228
- let H, $ = !1, U, se, ie, X;
229
- A && (H = A.getSpacedPoints(i), $ = !0, g = !1, U = A.computeFrenetFrames(i, !1), se = new _(), ie = new _(), X = new _()), g || (S = 0, u = 0, y = 0, L = 0);
230
- const ve = f.extractPoints(h);
231
- let R = ve.shape;
232
- const I = ve.holes;
233
- if (!fe.isClockWise(R)) {
234
- R = R.reverse();
235
- for (let l = 0, d = I.length; l < d; l++) {
236
- const m = I[l];
237
- fe.isClockWise(m) && (I[l] = m.reverse());
264
+ this.setAttribute("position", new rt(n, 3)), this.setAttribute("uv", new rt(r, 2)), this.computeVertexNormals();
265
+ function a(c) {
266
+ var Et, Gt, _t;
267
+ const o = [], h = e.curveSegments !== void 0 ? e.curveSegments : 12, i = e.steps !== void 0 ? e.steps : 1, l = e.depth !== void 0 ? e.depth : 1;
268
+ let g = e.bevelEnabled !== void 0 ? e.bevelEnabled : !0, d = e.bevelThickness !== void 0 ? e.bevelThickness : 0.2, y = e.bevelSize !== void 0 ? e.bevelSize : d - 0.1, A = e.bevelOffset !== void 0 ? e.bevelOffset : 0, x = e.bevelSegments !== void 0 ? e.bevelSegments : 3;
269
+ const v = e.extrudePath, E = e.UVGenerator !== void 0 ? e.UVGenerator : De, M = (Et = e.hasTop) != null ? Et : !0, _ = (Gt = e.hasBottom) != null ? Gt : !0, R = (_t = e.hasSide) != null ? _t : !0;
270
+ let V, X = !1, j, $, it, N;
271
+ v && (V = v.getSpacedPoints(i), X = !0, g = !1, j = v.computeFrenetFrames(i, !1), $ = new z(), it = new z(), N = new z()), g || (x = 0, d = 0, y = 0, A = 0);
272
+ const at = c.extractPoints(h);
273
+ let I = at.shape;
274
+ const U = at.holes;
275
+ if (!yt.isClockWise(I)) {
276
+ I = I.reverse();
277
+ for (let u = 0, m = U.length; u < m; u++) {
278
+ const p = U[u];
279
+ yt.isClockWise(p) && (U[u] = p.reverse());
238
280
  }
239
281
  }
240
- function Se(l) {
241
- const m = 10000000000000001e-36;
242
- let x = l[0];
243
- for (let b = 1; b <= l.length; b++) {
244
- const M = b % l.length, w = l[M], T = w.x - x.x, E = w.y - x.y, G = T * T + E * E, B = Math.max(
282
+ function ht(u) {
283
+ const p = 10000000000000001e-36;
284
+ let w = u[0];
285
+ for (let b = 1; b <= u.length; b++) {
286
+ const L = b % u.length, S = u[L], T = S.x - w.x, C = S.y - w.y, G = T * T + C * C, H = Math.max(
287
+ Math.abs(S.x),
288
+ Math.abs(S.y),
245
289
  Math.abs(w.x),
246
- Math.abs(w.y),
247
- Math.abs(x.x),
248
- Math.abs(x.y)
249
- ), Q = m * B * B;
250
- if (G <= Q) {
251
- l.splice(M, 1), b--;
290
+ Math.abs(w.y)
291
+ ), st = p * H * H;
292
+ if (G <= st) {
293
+ u.splice(L, 1), b--;
252
294
  continue;
253
295
  }
254
- x = w;
296
+ w = S;
255
297
  }
256
298
  }
257
- Se(R), I.forEach(Se);
258
- const pe = I.length, D = R;
259
- for (let l = 0; l < pe; l++) {
260
- const d = I[l];
261
- R = R.concat(d);
299
+ ht(I), U.forEach(ht);
300
+ const tt = U.length, B = I;
301
+ for (let u = 0; u < tt; u++) {
302
+ const m = U[u];
303
+ I = I.concat(m);
262
304
  }
263
- function te(l, d, m) {
264
- return d || error("ExtrudeGeometry: vec does not exist"), l.clone().addScaledVector(d, m);
305
+ function k(u, m, p) {
306
+ return m || error("ExtrudeGeometry: vec does not exist"), u.clone().addScaledVector(m, p);
265
307
  }
266
- const N = R.length;
267
- function Ae(l, d, m) {
268
- let x, b, M;
269
- const w = l.x - d.x, T = l.y - d.y, E = m.x - l.x, G = m.y - l.y, B = w * w + T * T, Q = w * G - T * E;
270
- if (Math.abs(Q) > Number.EPSILON) {
271
- const O = Math.sqrt(B), Pe = Math.sqrt(
272
- E * E + G * G
273
- ), Ce = d.x - T / O, _e = d.y + w / O, Ze = m.x - G / Pe, $e = m.y + E / Pe, ze = ((Ze - Ce) * G - ($e - _e) * E) / (w * G - T * E);
274
- x = Ce + w * ze - l.x, b = _e + T * ze - l.y;
275
- const je = x * x + b * b;
276
- if (je <= 2)
277
- return new P(x, b);
278
- M = Math.sqrt(je / 2);
308
+ const D = I.length;
309
+ function Lt(u, m, p) {
310
+ let w, b, L;
311
+ const S = u.x - m.x, T = u.y - m.y, C = p.x - u.x, G = p.y - u.y, H = S * S + T * T, st = S * G - T * C;
312
+ if (Math.abs(st) > Number.EPSILON) {
313
+ const W = Math.sqrt(H), Pt = Math.sqrt(
314
+ C * C + G * G
315
+ ), zt = m.x - T / W, jt = m.y + S / W, Qt = p.x - G / Pt, Kt = p.y + C / Pt, It = ((Qt - zt) * G - (Kt - jt) * C) / (S * G - T * C);
316
+ w = zt + S * It - u.x, b = jt + T * It - u.y;
317
+ const Ut = w * w + b * b;
318
+ if (Ut <= 2)
319
+ return new P(w, b);
320
+ L = Math.sqrt(Ut / 2);
279
321
  } else {
280
- let O = !1;
281
- w > Number.EPSILON ? E > Number.EPSILON && (O = !0) : w < -Number.EPSILON ? E < -Number.EPSILON && (O = !0) : Math.sign(T) === Math.sign(G) && (O = !0), O ? (x = -T, b = w, M = Math.sqrt(B)) : (x = w, b = T, M = Math.sqrt(B / 2));
322
+ let W = !1;
323
+ S > Number.EPSILON ? C > Number.EPSILON && (W = !0) : S < -Number.EPSILON ? C < -Number.EPSILON && (W = !0) : Math.sign(T) === Math.sign(G) && (W = !0), W ? (w = -T, b = S, L = Math.sqrt(H)) : (w = S, b = T, L = Math.sqrt(H / 2));
282
324
  }
283
- return new P(x / M, b / M);
325
+ return new P(w / L, b / L);
284
326
  }
285
- const re = [];
286
- for (let l = 0, d = D.length, m = d - 1, x = l + 1; l < d; l++, m++, x++)
287
- m === d && (m = 0), x === d && (x = 0), re[l] = Ae(D[l], D[m], D[x]);
288
- const ge = [];
289
- let q, ae = re.concat();
290
- for (let l = 0, d = pe; l < d; l++) {
291
- const m = I[l];
292
- q = [];
293
- for (let x = 0, b = m.length, M = b - 1, w = x + 1; x < b; x++, M++, w++)
294
- M === b && (M = 0), w === b && (w = 0), q[x] = Ae(m[x], m[M], m[w]);
295
- ge.push(q), ae = ae.concat(q);
327
+ const ut = [];
328
+ for (let u = 0, m = B.length, p = m - 1, w = u + 1; u < m; u++, p++, w++)
329
+ p === m && (p = 0), w === m && (w = 0), ut[u] = Lt(B[u], B[p], B[w]);
330
+ const wt = [];
331
+ let J, dt = ut.concat();
332
+ for (let u = 0, m = tt; u < m; u++) {
333
+ const p = U[u];
334
+ J = [];
335
+ for (let w = 0, b = p.length, L = b - 1, S = w + 1; w < b; w++, L++, S++)
336
+ L === b && (L = 0), S === b && (S = 0), J[w] = Lt(p[w], p[L], p[S]);
337
+ wt.push(J), dt = dt.concat(J);
296
338
  }
297
- let J;
298
- if (S === 0)
299
- J = fe.triangulateShape(D, I);
339
+ let et;
340
+ if (x === 0)
341
+ et = yt.triangulateShape(B, U);
300
342
  else {
301
- const l = [], d = [];
302
- for (let m = 0; m < S; m++) {
303
- const x = m / S, b = u * Math.cos(x * Math.PI / 2), M = y * Math.sin(x * Math.PI / 2) + L;
304
- for (let w = 0, T = D.length; w < T; w++) {
305
- const E = te(D[w], re[w], M);
306
- W(E.x, E.y, -b), x === 0 && l.push(E);
343
+ const u = [], m = [];
344
+ for (let p = 0; p < x; p++) {
345
+ const w = p / x, b = d * Math.cos(w * Math.PI / 2), L = y * Math.sin(w * Math.PI / 2) + A;
346
+ for (let S = 0, T = B.length; S < T; S++) {
347
+ const C = k(B[S], ut[S], L);
348
+ q(C.x, C.y, -b), w === 0 && u.push(C);
307
349
  }
308
- for (let w = 0, T = pe; w < T; w++) {
309
- const E = I[w];
310
- q = ge[w];
350
+ for (let S = 0, T = tt; S < T; S++) {
351
+ const C = U[S];
352
+ J = wt[S];
311
353
  const G = [];
312
- for (let B = 0, Q = E.length; B < Q; B++) {
313
- const O = te(E[B], q[B], M);
314
- W(O.x, O.y, -b), x === 0 && G.push(O);
354
+ for (let H = 0, st = C.length; H < st; H++) {
355
+ const W = k(C[H], J[H], L);
356
+ q(W.x, W.y, -b), w === 0 && G.push(W);
315
357
  }
316
- x === 0 && d.push(G);
358
+ w === 0 && m.push(G);
317
359
  }
318
360
  }
319
- J = fe.triangulateShape(
320
- l,
321
- d
361
+ et = yt.triangulateShape(
362
+ u,
363
+ m
322
364
  );
323
365
  }
324
- const ce = J.length, Me = y + L;
325
- for (let l = 0; l < N; l++) {
326
- const d = g ? te(R[l], ae[l], Me) : R[l];
327
- $ ? (ie.copy(U.normals[0]).multiplyScalar(d.x), se.copy(U.binormals[0]).multiplyScalar(d.y), X.copy(H[0]).add(ie).add(se), W(X.x, X.y, X.z)) : W(d.x, d.y, 0);
366
+ const ft = et.length, Tt = y + A;
367
+ for (let u = 0; u < D; u++) {
368
+ const m = g ? k(I[u], dt[u], Tt) : I[u];
369
+ X ? (it.copy(j.normals[0]).multiplyScalar(m.x), $.copy(j.binormals[0]).multiplyScalar(m.y), N.copy(V[0]).add(it).add($), q(N.x, N.y, N.z)) : q(m.x, m.y, 0);
328
370
  }
329
- for (let l = 1; l <= i; l++)
330
- for (let d = 0; d < N; d++) {
331
- const m = g ? te(R[d], ae[d], Me) : R[d];
332
- $ ? (ie.copy(U.normals[l]).multiplyScalar(m.x), se.copy(U.binormals[l]).multiplyScalar(m.y), X.copy(H[l]).add(ie).add(se), W(X.x, X.y, X.z)) : W(m.x, m.y, c / i * l);
371
+ for (let u = 1; u <= i; u++)
372
+ for (let m = 0; m < D; m++) {
373
+ const p = g ? k(I[m], dt[m], Tt) : I[m];
374
+ X ? (it.copy(j.normals[u]).multiplyScalar(p.x), $.copy(j.binormals[u]).multiplyScalar(p.y), N.copy(V[u]).add(it).add($), q(N.x, N.y, N.z)) : q(p.x, p.y, l / i * u);
333
375
  }
334
- for (let l = S - 1; l >= 0; l--) {
335
- const d = l / S, m = u * Math.cos(d * Math.PI / 2), x = y * Math.sin(d * Math.PI / 2) + L;
336
- for (let b = 0, M = D.length; b < M; b++) {
337
- const w = te(D[b], re[b], x);
338
- W(w.x, w.y, c + m);
376
+ for (let u = x - 1; u >= 0; u--) {
377
+ const m = u / x, p = d * Math.cos(m * Math.PI / 2), w = y * Math.sin(m * Math.PI / 2) + A;
378
+ for (let b = 0, L = B.length; b < L; b++) {
379
+ const S = k(B[b], ut[b], w);
380
+ q(S.x, S.y, l + p);
339
381
  }
340
- for (let b = 0, M = I.length; b < M; b++) {
341
- const w = I[b];
342
- q = ge[b];
343
- for (let T = 0, E = w.length; T < E; T++) {
344
- const G = te(w[T], q[T], x);
345
- $ ? W(
382
+ for (let b = 0, L = U.length; b < L; b++) {
383
+ const S = U[b];
384
+ J = wt[b];
385
+ for (let T = 0, C = S.length; T < C; T++) {
386
+ const G = k(S[T], J[T], w);
387
+ X ? q(
346
388
  G.x,
347
- G.y + H[i - 1].y,
348
- H[i - 1].x + m
349
- ) : W(G.x, G.y, c + m);
389
+ G.y + V[i - 1].y,
390
+ V[i - 1].x + p
391
+ ) : q(G.x, G.y, l + p);
350
392
  }
351
393
  }
352
394
  }
353
- Fe(), ee && qe();
354
- function Fe() {
355
- const l = s.length / 3;
395
+ Zt(), R && $t();
396
+ function Zt() {
397
+ const u = n.length / 3;
356
398
  if (g) {
357
- let d = 0, m = N * d;
358
- if (j)
359
- for (let x = 0; x < ce; x++) {
360
- const b = J[x];
361
- le(b[2] + m, b[1] + m, b[0] + m);
399
+ let m = 0, p = D * m;
400
+ if (_)
401
+ for (let w = 0; w < ft; w++) {
402
+ const b = et[w];
403
+ mt(b[2] + p, b[1] + p, b[0] + p);
362
404
  }
363
- if (d = i + S * 2, m = N * d, v)
364
- for (let x = 0; x < ce; x++) {
365
- const b = J[x];
366
- le(b[0] + m, b[1] + m, b[2] + m);
405
+ if (m = i + x * 2, p = D * m, M)
406
+ for (let w = 0; w < ft; w++) {
407
+ const b = et[w];
408
+ mt(b[0] + p, b[1] + p, b[2] + p);
367
409
  }
368
410
  } else {
369
- if (j)
370
- for (let d = 0; d < ce; d++) {
371
- const m = J[d];
372
- le(m[2], m[1], m[0]);
411
+ if (_)
412
+ for (let m = 0; m < ft; m++) {
413
+ const p = et[m];
414
+ mt(p[2], p[1], p[0]);
373
415
  }
374
- if (v)
375
- for (let d = 0; d < ce; d++) {
376
- const m = J[d];
377
- le(
378
- m[0] + N * i,
379
- m[1] + N * i,
380
- m[2] + N * i
416
+ if (M)
417
+ for (let m = 0; m < ft; m++) {
418
+ const p = et[m];
419
+ mt(
420
+ p[0] + D * i,
421
+ p[1] + D * i,
422
+ p[2] + D * i
381
423
  );
382
424
  }
383
425
  }
384
- n.addGroup(l, s.length / 3 - l, 0);
426
+ s.addGroup(u, n.length / 3 - u, 0);
385
427
  }
386
- function qe() {
387
- const l = s.length / 3;
388
- let d = 0;
389
- Le(D, d), d += D.length;
390
- for (let m = 0, x = I.length; m < x; m++) {
391
- const b = I[m];
392
- Le(b, d), d += b.length;
428
+ function $t() {
429
+ const u = n.length / 3;
430
+ let m = 0;
431
+ Ct(B, m), m += B.length;
432
+ for (let p = 0, w = U.length; p < w; p++) {
433
+ const b = U[p];
434
+ Ct(b, m), m += b.length;
393
435
  }
394
- n.addGroup(l, s.length / 3 - l, 1);
436
+ s.addGroup(u, n.length / 3 - u, 1);
395
437
  }
396
- function Le(l, d) {
397
- let m = l.length;
398
- for (; --m >= 0; ) {
399
- const x = m;
400
- let b = m - 1;
401
- b < 0 && (b = l.length - 1);
402
- for (let M = 0, w = i + S * 2; M < w; M++) {
403
- const T = N * M, E = N * (M + 1), G = d + x + T, B = d + b + T, Q = d + b + E, O = d + x + E;
404
- Ye(G, B, Q, O);
438
+ function Ct(u, m) {
439
+ let p = u.length;
440
+ for (; --p >= 0; ) {
441
+ const w = p;
442
+ let b = p - 1;
443
+ b < 0 && (b = u.length - 1);
444
+ for (let L = 0, S = i + x * 2; L < S; L++) {
445
+ const T = D * L, C = D * (L + 1), G = m + w + T, H = m + b + T, st = m + b + C, W = m + w + C;
446
+ Jt(G, H, st, W);
405
447
  }
406
448
  }
407
449
  }
408
- function W(l, d, m) {
409
- r.push(l), r.push(d), r.push(m);
450
+ function q(u, m, p) {
451
+ o.push(u), o.push(m), o.push(p);
410
452
  }
411
- function le(l, d, m) {
412
- k(l), k(d), k(m);
413
- const x = s.length / 3, b = C.generateTopUV(
414
- n,
453
+ function mt(u, m, p) {
454
+ Y(u), Y(m), Y(p);
455
+ const w = n.length / 3, b = E.generateTopUV(
415
456
  s,
416
- x - 3,
417
- x - 2,
418
- x - 1
457
+ n,
458
+ w - 3,
459
+ w - 2,
460
+ w - 1
419
461
  );
420
- F(b[0]), F(b[1]), F(b[2]);
462
+ Z(b[0]), Z(b[1]), Z(b[2]);
421
463
  }
422
- function Ye(l, d, m, x) {
423
- k(l), k(d), k(x), k(d), k(m), k(x);
424
- const b = s.length / 3, M = C.generateSideWallUV(
425
- n,
464
+ function Jt(u, m, p, w) {
465
+ Y(u), Y(m), Y(w), Y(m), Y(p), Y(w);
466
+ const b = n.length / 3, L = E.generateSideWallUV(
426
467
  s,
468
+ n,
427
469
  b - 6,
428
470
  b - 3,
429
471
  b - 2,
430
472
  b - 1
431
473
  );
432
- F(M[0]), F(M[1]), F(M[3]), F(M[1]), F(M[2]), F(M[3]);
474
+ Z(L[0]), Z(L[1]), Z(L[3]), Z(L[1]), Z(L[2]), Z(L[3]);
433
475
  }
434
- function k(l) {
435
- s.push(r[l * 3 + 0]), s.push(r[l * 3 + 1]), s.push(r[l * 3 + 2]);
476
+ function Y(u) {
477
+ n.push(o[u * 3 + 0]), n.push(o[u * 3 + 1]), n.push(o[u * 3 + 2]);
436
478
  }
437
- function F(l) {
438
- o.push(l.x), o.push(l.y);
479
+ function Z(u) {
480
+ r.push(u.x), r.push(u.y);
439
481
  }
440
482
  }
441
483
  }
442
- copy(e) {
443
- return super.copy(e), this.parameters = Object.assign({}, e.parameters), this;
484
+ copy(t) {
485
+ return super.copy(t), this.parameters = Object.assign({}, t.parameters), this;
444
486
  }
445
487
  toJSON() {
446
- const e = super.toJSON(), t = this.parameters.shapes, n = this.parameters.options;
447
- return Rt(t, n, e);
488
+ const t = super.toJSON(), e = this.parameters.shapes, s = this.parameters.options;
489
+ return He(e, s, t);
448
490
  }
449
491
  /**
450
492
  * Factory method for creating an instance of this class from the given
@@ -454,695 +496,797 @@ class K extends me {
454
496
  * @param {Array<Shape>} shapes - An array of shapes.
455
497
  * @return {ExtrudeGeometry} A new instance.
456
498
  */
457
- static fromJSON(e, t) {
458
- const n = [];
459
- for (let o = 0, a = e.shapes.length; o < a; o++) {
460
- const f = t[e.shapes[o]];
461
- n.push(f);
499
+ static fromJSON(t, e) {
500
+ const s = [];
501
+ for (let r = 0, a = t.shapes.length; r < a; r++) {
502
+ const c = e[t.shapes[r]];
503
+ s.push(c);
462
504
  }
463
- const s = e.options.extrudePath;
464
- return s !== void 0 && (e.options.extrudePath = new Bt[s.type]().fromJSON(
465
- s
466
- )), new K(n, e.options);
505
+ const n = t.options.extrudePath;
506
+ return n !== void 0 && (t.options.extrudePath = new Oe[n.type]().fromJSON(
507
+ n
508
+ )), new nt(s, t.options);
467
509
  }
468
510
  }
469
- const Ot = {
470
- generateTopUV: function(p, e, t, n, s) {
471
- const o = e[t * 3], a = e[t * 3 + 1], f = e[n * 3], r = e[n * 3 + 1], h = e[s * 3], i = e[s * 3 + 1];
511
+ const De = {
512
+ generateTopUV: function(f, t, e, s, n) {
513
+ const r = t[e * 3], a = t[e * 3 + 1], c = t[s * 3], o = t[s * 3 + 1], h = t[n * 3], i = t[n * 3 + 1];
472
514
  return [
473
- new P(o, a),
474
- new P(f, r),
515
+ new P(r, a),
516
+ new P(c, o),
475
517
  new P(h, i)
476
518
  ];
477
519
  },
478
- generateSideWallUV: function(p, e, t, n, s, o) {
479
- const a = e[t * 3], f = e[t * 3 + 1], r = e[t * 3 + 2], h = e[n * 3], i = e[n * 3 + 1], c = e[n * 3 + 2], g = e[s * 3], u = e[s * 3 + 1], y = e[s * 3 + 2], L = e[o * 3], S = e[o * 3 + 1], A = e[o * 3 + 2];
480
- return Math.abs(f - i) < Math.abs(a - h) ? [
481
- new P(a, 1 - r),
482
- new P(h, 1 - c),
520
+ generateSideWallUV: function(f, t, e, s, n, r) {
521
+ const a = t[e * 3], c = t[e * 3 + 1], o = t[e * 3 + 2], h = t[s * 3], i = t[s * 3 + 1], l = t[s * 3 + 2], g = t[n * 3], d = t[n * 3 + 1], y = t[n * 3 + 2], A = t[r * 3], x = t[r * 3 + 1], v = t[r * 3 + 2];
522
+ return Math.abs(c - i) < Math.abs(a - h) ? [
523
+ new P(a, 1 - o),
524
+ new P(h, 1 - l),
483
525
  new P(g, 1 - y),
484
- new P(L, 1 - A)
526
+ new P(A, 1 - v)
485
527
  ] : [
486
- new P(f, 1 - r),
487
- new P(i, 1 - c),
488
- new P(u, 1 - y),
489
- new P(S, 1 - A)
528
+ new P(c, 1 - o),
529
+ new P(i, 1 - l),
530
+ new P(d, 1 - y),
531
+ new P(x, 1 - v)
490
532
  ];
491
533
  }
492
534
  };
493
- function Rt(p, e, t) {
494
- if (t.shapes = [], Array.isArray(p))
495
- for (let n = 0, s = p.length; n < s; n++) {
496
- const o = p[n];
497
- t.shapes.push(o.uuid);
535
+ function He(f, t, e) {
536
+ if (e.shapes = [], Array.isArray(f))
537
+ for (let s = 0, n = f.length; s < n; s++) {
538
+ const r = f[s];
539
+ e.shapes.push(r.uuid);
498
540
  }
499
541
  else
500
- t.shapes.push(p.uuid);
501
- return t.options = Object.assign({}, e), e.extrudePath !== void 0 && (t.options.extrudePath = e.extrudePath.toJSON()), t;
542
+ e.shapes.push(f.uuid);
543
+ return e.options = Object.assign({}, t), t.extrudePath !== void 0 && (e.options.extrudePath = t.extrudePath.toJSON()), e;
502
544
  }
503
- class Ut extends K {
504
- constructor(e, t) {
505
- super(e, t);
506
- const n = new Ue(
507
- new K(e, ue(z({}, t), {
545
+ class We extends nt {
546
+ constructor(t, e) {
547
+ super(t, e);
548
+ const s = new Dt(
549
+ new nt(t, gt(O({}, e), {
508
550
  hasTop: !0,
509
551
  hasSide: !0,
510
552
  hasBottom: !1
511
553
  }))
512
554
  );
513
- n.updateMatrixWorld();
514
- const s = new pt().setFromObject(n), o = new _();
515
- s.getSize(o);
516
- const a = new _(
517
- s.min.x + o.x / 2,
518
- s.min.y + o.y / 2,
555
+ s.updateMatrixWorld();
556
+ const n = new we().setFromObject(s), r = new z();
557
+ n.getSize(r);
558
+ const a = new z(
559
+ n.min.x + r.x / 2,
560
+ n.min.y + r.y / 2,
519
561
  0
520
562
  );
521
- let f = t.topSegments, r = t.box3;
522
- if (r) {
523
- r = r.union(s);
524
- const A = new _();
525
- r.getSize(A);
526
- const C = Math.max(
527
- o.x / A.x,
528
- o.y / A.y
563
+ let c = e.topSegments, o = e.box3;
564
+ if (o) {
565
+ o = o.union(n);
566
+ const v = new z();
567
+ o.getSize(v);
568
+ const E = Math.max(
569
+ r.x / v.x,
570
+ r.y / v.y
529
571
  );
530
- f = Math.ceil(t.topSegments * C);
572
+ c = Math.ceil(e.topSegments * E);
531
573
  }
532
- if (f < 4)
574
+ if (c < 4)
533
575
  return this;
534
- const h = new gt(
535
- o.x,
536
- o.y,
537
- f,
538
- f
539
- ), i = new Ue(h);
576
+ const h = new xe(
577
+ r.x,
578
+ r.y,
579
+ c,
580
+ c
581
+ ), i = new Dt(h);
540
582
  i.position.set(a.x, a.y, a.z), i.updateMatrixWorld();
541
- const g = new _t().evaluate(i, n, zt), u = g.geometry.getAttribute("position"), y = new xe(
542
- u.count * 2,
583
+ const g = new Ie().evaluate(i, s, Ue), d = g.geometry.getAttribute("position"), y = new rt(
584
+ d.count * 2,
543
585
  2
544
586
  );
545
- for (let A = 0; A < u.count; A++) {
546
- const C = u.getZ(A);
547
- u.setZ(A, t.depth + C);
587
+ for (let v = 0; v < d.count; v++) {
588
+ const E = d.getZ(v);
589
+ d.setZ(v, e.depth + E);
548
590
  }
549
- if (r) {
550
- const A = r.min, C = r.max, v = new _().subVectors(C, A);
551
- for (let j = 0; j < u.count; j++) {
552
- const ee = u.getX(j), H = u.getY(j), $ = (ee - A.x) / v.x, U = (H - A.y) / v.y;
553
- y.setXY(j, $, U);
591
+ if (o) {
592
+ const v = o.min, E = o.max, M = new z().subVectors(E, v);
593
+ for (let _ = 0; _ < d.count; _++) {
594
+ const R = d.getX(_), V = d.getY(_), X = (R - v.x) / M.x, j = (V - v.y) / M.y;
595
+ y.setXY(_, X, j);
554
596
  }
555
597
  g.geometry.setAttribute("uv", y);
556
598
  }
557
- u.needsUpdate = !0;
558
- const L = new K(e, ue(z({}, t), {
599
+ d.needsUpdate = !0;
600
+ const A = new nt(t, gt(O({}, e), {
559
601
  hasTop: !1
560
- })), S = V([g.geometry, L], 2);
561
- this.copy(S.toNonIndexed());
602
+ })), x = F([g.geometry, A], 2);
603
+ this.copy(x.toNonIndexed());
562
604
  }
563
605
  }
564
- const Ve = (p) => {
606
+ const Wt = (f) => {
565
607
  const {
566
- split: e,
567
- depth: t,
568
- points: n,
569
- box3: s,
570
- hasTop: o,
608
+ split: t,
609
+ depth: e,
610
+ points: s,
611
+ box3: n,
612
+ hasTop: r,
571
613
  hasBottom: a,
572
- hasSide: f,
573
- sideRepeat: r,
614
+ hasSide: c,
615
+ sideRepeat: o,
574
616
  topSegments: h
575
- } = p, i = h ? Ut : K, c = new i(new we(n), {
576
- depth: t,
617
+ } = f, i = h ? We : nt, l = new i(new St(s), {
618
+ depth: e,
577
619
  bevelEnabled: !1,
578
- box3: s,
579
- UVGenerator: Pt({
580
- split: e,
581
- box3: s,
582
- sideRepeat: r
620
+ box3: n,
621
+ UVGenerator: ze({
622
+ split: t,
623
+ box3: n,
624
+ sideRepeat: o
583
625
  }),
584
- hasTop: o,
626
+ hasTop: r,
585
627
  hasBottom: a,
586
- hasSide: f,
628
+ hasSide: c,
587
629
  topSegments: h
588
630
  });
589
- return Ct(), c;
631
+ return je(), l;
590
632
  };
591
- class Qt extends Z {
592
- constructor(e) {
593
- super(), this.options = z({
633
+ class ns extends K {
634
+ constructor(t) {
635
+ super(), this.options = O({
594
636
  depth: 1
595
- }, e);
637
+ }, t);
596
638
  }
597
639
  create() {
598
- return oe(this, null, function* () {
640
+ return ct(this, null, function* () {
599
641
  const {
600
- points: e,
601
- pointsArr: t,
602
- useGroups: n,
603
- depth: s,
604
- geometry: o,
642
+ points: t,
643
+ pointsArr: e,
644
+ useGroups: s,
645
+ depth: n,
646
+ geometry: r,
605
647
  geometryArr: a,
606
- material: f,
607
- box3: r,
648
+ material: c,
649
+ box3: o,
608
650
  split: h,
609
651
  hasTop: i,
610
- hasBottom: c,
652
+ hasBottom: l,
611
653
  hasSide: g
612
- } = this.options, u = Array.isArray(s) ? s : [s], y = Array.isArray(r) ? r : [r], L = f;
613
- let S = o;
614
- L || console.log("material is null"), !S && e ? S = Ve({
615
- points: e,
616
- depth: u[0],
654
+ } = this.options, d = Array.isArray(n) ? n : [n], y = Array.isArray(o) ? o : [o], A = c;
655
+ let x = r;
656
+ A || console.log("material is null"), !x && t ? x = Wt({
657
+ points: t,
658
+ depth: d[0],
617
659
  box3: y[0],
618
660
  split: h,
619
661
  hasTop: i,
620
- hasBottom: c,
662
+ hasBottom: l,
621
663
  hasSide: g
622
- }) : !S && t ? S = V(
623
- t.map(
624
- (A, C) => {
625
- var v, j;
626
- return Ve({
627
- points: A,
628
- depth: (v = u[C]) != null ? v : u[0],
629
- box3: (j = y[C]) != null ? j : y[0],
664
+ }) : !x && e ? x = F(
665
+ e.map(
666
+ (v, E) => {
667
+ var M, _;
668
+ return Wt({
669
+ points: v,
670
+ depth: (M = d[E]) != null ? M : d[0],
671
+ box3: (_ = y[E]) != null ? _ : y[0],
630
672
  split: h,
631
673
  hasTop: i,
632
- hasBottom: c,
674
+ hasBottom: l,
633
675
  hasSide: g
634
676
  });
635
677
  }
636
678
  ),
637
- n != null ? n : 0
638
- ) : !S && a && a.length > 1 ? S = V(a, n != null ? n : 0) : !S && a && a.length === 1 && ([S] = a), this.createMesh(S, L);
679
+ s != null ? s : 0
680
+ ) : !x && a && a.length > 1 ? x = F(a, s != null ? s : 0) : !x && a && a.length === 1 && ([x] = a), this.createMesh(x, A);
639
681
  });
640
682
  }
641
- addGeometries(e) {
642
- const t = this.object3d, n = V([t.geometry, ...e]);
643
- t.geometry = n;
683
+ addGeometries(t) {
684
+ const e = this.object3d, s = F([e.geometry, ...t]);
685
+ e.geometry = s;
644
686
  }
645
- setTextureAnisotropic(e, t) {
646
- e.anisotropy = t || this.pencil.renderer.capabilities.getMaxAnisotropy();
687
+ setTextureAnisotropic(t, e) {
688
+ t.anisotropy = e || this.pencil.renderer.capabilities.getMaxAnisotropy();
647
689
  }
648
690
  }
649
- const Kt = (p) => {
691
+ const is = (f) => {
650
692
  const {
651
- topColor: e,
652
- sideColor: t,
653
- sideMap: n,
654
- createCanvasObjectURL: s,
655
- split: o,
693
+ topColor: t,
694
+ sideColor: e,
695
+ sideMap: s,
696
+ createCanvasObjectURL: n,
697
+ split: r,
656
698
  maxAnisotropy: a
657
- } = p;
658
- return new Promise((f) => {
659
- const r = n ? document.createElement("img") : {
699
+ } = f;
700
+ return new Promise((c) => {
701
+ const o = s ? document.createElement("img") : {
660
702
  src: "",
661
703
  onload: () => {
662
704
  },
663
705
  width: 128,
664
706
  height: 128
665
707
  };
666
- r.onload = () => {
667
- const h = o, i = document.createElement("canvas"), c = i.getContext("2d");
668
- i.height = r.height / (1 - h), i.width = r.width, h && e && (c.fillStyle = e, c.fillRect(0, 0, r.width, i.height * h)), n && r instanceof HTMLImageElement ? c.drawImage(r, 0, i.height * h, r.width, r.height) : t && (c.fillStyle = t, c.fillRect(0, i.height * h, r.width, r.height)), s && i.toBlob((u) => {
669
- console.log(URL.createObjectURL(u));
708
+ o.onload = () => {
709
+ const h = r, i = document.createElement("canvas"), l = i.getContext("2d");
710
+ i.height = o.height / (1 - h), i.width = o.width, h && t && (l.fillStyle = t, l.fillRect(0, 0, o.width, i.height * h)), s && o instanceof HTMLImageElement ? l.drawImage(o, 0, i.height * h, o.width, o.height) : e && (l.fillStyle = e, l.fillRect(0, i.height * h, o.width, o.height)), n && i.toBlob((d) => {
711
+ console.log(URL.createObjectURL(d));
670
712
  });
671
- const g = new yt(i);
672
- f(g);
673
- }, n ? r.src = n : r instanceof HTMLImageElement || r.onload();
713
+ const g = new ve(i);
714
+ c(g);
715
+ }, s ? o.src = s : o instanceof HTMLImageElement || o.onload();
674
716
  });
675
717
  };
676
- class en extends Z {
718
+ class os extends K {
677
719
  create() {
678
720
  this.createGroup();
679
721
  }
722
+ render() {
723
+ this.object3d.raycast = (t, e) => t.intersectObjects(
724
+ this.object3d.children,
725
+ !0,
726
+ e
727
+ );
728
+ }
680
729
  }
681
- class tn extends Z {
682
- constructor(e) {
683
- super(), this.rectAreaLightUniformsLibInit = !1, this.options = e;
730
+ class rs extends K {
731
+ constructor(t) {
732
+ super(), this.rectAreaLightUniformsLibInit = !1, this.options = t;
684
733
  }
685
734
  create() {
686
- var t, n, s, o, a, f, r, h, i, c, g, u, y, L, S, A, C;
687
- const e = this.options;
688
- if (e.type === "AmbientLight") {
689
- const v = new bt(e.color);
690
- v.name = "环境光", this.object3d = v;
691
- } else if (e.type === "DirectionalLight") {
692
- const v = new xt(e.color, e.intensity);
693
- v.name = "平行光", v.target.position.set(0, 0, 0), this.object3d = v, v.target.name = "平行光目标", v.shadow.camera.name = "平行光阴影相机", v.shadow.camera.userData.directionalLightShadow = !0, this.directionalLight = v;
694
- } else if (e.type === "PointLight") {
695
- const v = new wt(
696
- (t = e.color) != null ? t : 16777215,
697
- (n = e.intensity) != null ? n : 1,
698
- (s = e.distance) != null ? s : 0,
699
- (o = e.decay) != null ? o : 2
735
+ var e, s, n, r, a, c, o, h, i, l, g, d, y, A, x, v, E;
736
+ const t = this.options;
737
+ if (t.type === "AmbientLight") {
738
+ const M = new Me(t.color);
739
+ M.name = "环境光", this.object3d = M;
740
+ } else if (t.type === "DirectionalLight") {
741
+ const M = new Se(t.color, t.intensity);
742
+ M.name = "平行光", M.target.position.set(0, 0, 0), this.object3d = M, M.target.name = "平行光目标", M.shadow.camera.name = "平行光阴影相机", M.shadow.camera.userData.directionalLightShadow = !0, this.directionalLight = M;
743
+ } else if (t.type === "PointLight") {
744
+ const M = new Ae(
745
+ (e = t.color) != null ? e : 16777215,
746
+ (s = t.intensity) != null ? s : 1,
747
+ (n = t.distance) != null ? n : 0,
748
+ (r = t.decay) != null ? r : 2
700
749
  );
701
- v.name = "点光源", this.object3d = v, this.pointLight = v;
702
- } else if (e.type === "SpotLight") {
703
- const v = new vt(
704
- (a = e.color) != null ? a : 16777215,
705
- (f = e.intensity) != null ? f : 1,
706
- (r = e.distance) != null ? r : 0,
707
- (h = e.angle) != null ? h : Math.PI / 3,
708
- (i = e.penumbra) != null ? i : 1,
709
- (c = e.decay) != null ? c : 2
750
+ M.name = "点光源", this.object3d = M, this.pointLight = M;
751
+ } else if (t.type === "SpotLight") {
752
+ const M = new Le(
753
+ (a = t.color) != null ? a : 16777215,
754
+ (c = t.intensity) != null ? c : 1,
755
+ (o = t.distance) != null ? o : 0,
756
+ (h = t.angle) != null ? h : Math.PI / 3,
757
+ (i = t.penumbra) != null ? i : 1,
758
+ (l = t.decay) != null ? l : 2
710
759
  );
711
- v.name = "聚光灯", this.object3d = v, this.spotLight = v, v.target.name = "聚光灯目标";
712
- } else if (e.type === "HemisphereLight") {
713
- const v = new St(
714
- (g = e.color) != null ? g : 16777215,
715
- (u = e.groundColor) != null ? u : 16777215,
716
- (y = e.intensity) != null ? y : 1
760
+ M.name = "聚光灯", this.object3d = M, this.spotLight = M, M.target.name = "聚光灯目标";
761
+ } else if (t.type === "HemisphereLight") {
762
+ const M = new Te(
763
+ (g = t.color) != null ? g : 16777215,
764
+ (d = t.groundColor) != null ? d : 16777215,
765
+ (y = t.intensity) != null ? y : 1
717
766
  );
718
- v.name = "半球光", this.object3d = v, this.hemisphereLight = v;
719
- } else if (e.type === "RectAreaLight") {
720
- this.rectAreaLightUniformsLibInit || (jt.init(), this.rectAreaLightUniformsLibInit = !0);
721
- const v = new At(
722
- (L = e.color) != null ? L : 16777215,
723
- (S = e.intensity) != null ? S : 1,
724
- (A = e.width) != null ? A : 10,
725
- (C = e.height) != null ? C : 10
767
+ M.name = "半球光", this.object3d = M, this.hemisphereLight = M;
768
+ } else if (t.type === "RectAreaLight") {
769
+ this.rectAreaLightUniformsLibInit || (Be.init(), this.rectAreaLightUniformsLibInit = !0);
770
+ const M = new Ce(
771
+ (A = t.color) != null ? A : 16777215,
772
+ (x = t.intensity) != null ? x : 1,
773
+ (v = t.width) != null ? v : 10,
774
+ (E = t.height) != null ? E : 10
726
775
  );
727
- v.name = "矩形区域光", this.object3d = v, this.rectAreaLight = v;
776
+ M.name = "矩形区域光", this.object3d = M, this.rectAreaLight = M;
728
777
  }
729
778
  }
730
779
  render() {
731
- const e = this.object3d;
732
- e.target && this.pencil.scene.add(e.target);
733
- const t = this.pencil.cameraTarget;
780
+ const t = this.object3d;
781
+ t.target && this.pencil.scene.add(t.target);
782
+ const e = this.pencil.cameraTarget;
734
783
  if (this.spotLight || this.directionalLight) {
735
- const n = this.spotLight || this.directionalLight;
736
- n.position.copy(t), n.target.position.copy(t);
737
- } else this.pointLight && this.pointLight.position.copy(t);
784
+ const s = this.spotLight || this.directionalLight;
785
+ s.position.copy(e), s.target.position.copy(e);
786
+ } else this.pointLight && this.pointLight.position.copy(e);
738
787
  }
739
788
  dispose() {
740
- const e = this.object3d;
741
- e.target && this.pencil.scene.remove(e.target), super.dispose();
789
+ const t = this.object3d;
790
+ t.target && this.pencil.scene.remove(t.target), super.dispose();
742
791
  }
743
792
  }
744
- class Dt extends me {
745
- constructor(e = [], t = "none", n) {
746
- super(), this.type = "MeshLineGeometry", this.pointCount = 0, this._points = [], this.shape = "none", this.shapeFunction = (s) => 1, this.matrixWorld = new Ne(), this.shape = t, n && (this.shapeFunction = n), e.length > 0 && this.setPoints(e);
747
- }
748
- convertToVector3Array(e) {
749
- if (typeof e[0] == "number") {
750
- const t = [], n = e;
751
- for (let s = 0; s < n.length; s += 3)
752
- t.push(new _(n[s], n[s + 1], n[s + 2]));
753
- return t;
793
+ class Ne extends lt {
794
+ constructor(t = [], e = "none", s) {
795
+ super(), this.type = "MeshLineGeometry", this.pointCount = 0, this._points = [], this.shape = "none", this.shapeFunction = (n) => 1, this.matrixWorld = new Ft(), this.shape = e, s && (this.shapeFunction = s), t.length > 0 && this.setPoints(t);
796
+ }
797
+ convertToVector3Array(t) {
798
+ if (typeof t[0] == "number") {
799
+ const e = [], s = t;
800
+ for (let n = 0; n < s.length; n += 3)
801
+ e.push(new z(s[n], s[n + 1], s[n + 2]));
802
+ return e;
754
803
  } else
755
- return e.map((t) => {
756
- if (t instanceof P)
757
- return new _(t.x, t.y, 0);
758
- if (t instanceof _)
759
- return t;
760
- if (Array.isArray(t) && t.length === 2)
761
- return new _(t[0], t[1], 0);
762
- if (Array.isArray(t) && t.length === 3)
763
- return new _(t[0], t[1], t[2]);
804
+ return t.map((e) => {
805
+ if (e instanceof P)
806
+ return new z(e.x, e.y, 0);
807
+ if (e instanceof z)
808
+ return e;
809
+ if (Array.isArray(e) && e.length === 2)
810
+ return new z(e[0], e[1], 0);
811
+ if (Array.isArray(e) && e.length === 3)
812
+ return new z(e[0], e[1], e[2]);
764
813
  }).filter(Boolean);
765
814
  }
766
- setMatrixWorld(e) {
767
- this.matrixWorld = e;
815
+ setMatrixWorld(t) {
816
+ this.matrixWorld = t;
768
817
  }
769
- setPoints(e, t) {
770
- !e || e.length === 0 || (this._points = this.convertToVector3Array(e), this.pointCount = this._points.length, t && (this.shapeFunction = t, this.shape = "custom"), this.initializeGeometry(), this.updateGeometry());
818
+ setPoints(t, e) {
819
+ !t || t.length === 0 || (this._points = this.convertToVector3Array(t), this.pointCount = this._points.length, e && (this.shapeFunction = e, this.shape = "custom"), this.initializeGeometry(), this.updateGeometry());
771
820
  }
772
821
  initializeGeometry() {
773
- const e = new Y(
822
+ const t = new Q(
774
823
  new Float32Array(this.pointCount * 6),
775
824
  3
776
- ), t = new Y(
825
+ ), e = new Q(
777
826
  new Float32Array(this.pointCount * 6),
778
827
  3
779
- ), n = new Y(new Float32Array(this.pointCount * 6), 3), s = new Y(
828
+ ), s = new Q(new Float32Array(this.pointCount * 6), 3), n = new Q(
780
829
  new Float32Array(this.pointCount * 2),
781
830
  1
782
- ), o = new Y(new Float32Array(this.pointCount * 2), 1), a = new Y(new Float32Array(this.pointCount * 2), 1), f = new Y(new Float32Array(this.pointCount * 4), 2), r = new Y(
831
+ ), r = new Q(new Float32Array(this.pointCount * 2), 1), a = new Q(new Float32Array(this.pointCount * 2), 1), c = new Q(new Float32Array(this.pointCount * 4), 2), o = new Q(
783
832
  new Uint16Array((this.pointCount - 1) * 6),
784
833
  1
785
834
  );
786
835
  this.shape === "taper" && (this.shapeFunction = (h) => 1 * Math.pow(4 * h * (1 - h), 1));
787
- for (let h = 0, i = 0, c = 0; h < this.pointCount; h += 1, i += 2, c += 6) {
788
- s.setX(i, h / this.pointCount), s.setX(i + 1, h / this.pointCount), o.setX(i, 1), o.setX(i + 1, -1);
836
+ for (let h = 0, i = 0, l = 0; h < this.pointCount; h += 1, i += 2, l += 6) {
837
+ n.setX(i, h / this.pointCount), n.setX(i + 1, h / this.pointCount), r.setX(i, 1), r.setX(i + 1, -1);
789
838
  const g = this.shape === "none" ? 1 : this.shapeFunction(h / (this.pointCount - 1));
790
839
  a.setX(i, g), a.setX(i + 1, g);
791
- const u = h / (this.pointCount - 1);
792
- if (f.setXY(i, u, 0), f.setXY(i + 1, u, 1), h < this.pointCount - 1) {
840
+ const d = h / (this.pointCount - 1);
841
+ if (c.setXY(i, d, 0), c.setXY(i + 1, d, 1), h < this.pointCount - 1) {
793
842
  const y = h * 2;
794
- r.setX(c + 0, y + 0), r.setX(c + 1, y + 1), r.setX(c + 2, y + 2), r.setX(c + 3, y + 2), r.setX(c + 4, y + 1), r.setX(c + 5, y + 3);
843
+ o.setX(l + 0, y + 0), o.setX(l + 1, y + 1), o.setX(l + 2, y + 2), o.setX(l + 3, y + 2), o.setX(l + 4, y + 1), o.setX(l + 5, y + 3);
795
844
  }
796
845
  }
797
- this.setAttribute("position", e), this.setAttribute("previous", t), this.setAttribute("next", n), this.setAttribute("counters", s), this.setAttribute("side", o), this.setAttribute("width", a), this.setAttribute("uv", f), this.setIndex(r);
846
+ this.setAttribute("position", t), this.setAttribute("previous", e), this.setAttribute("next", s), this.setAttribute("counters", n), this.setAttribute("side", r), this.setAttribute("width", a), this.setAttribute("uv", c), this.setIndex(o);
798
847
  }
799
848
  updateGeometry() {
800
849
  if (!this._points[0]) return;
801
- const e = this.getAttribute("position"), t = this.getAttribute("previous"), n = this.getAttribute("next");
802
- let s = 0, o = 0, a = 0;
803
- const f = this._points[0];
804
- t.setXYZ(o, f.x, f.y, f.z), o += 1, t.setXYZ(o, f.x, f.y, f.z), o += 1;
850
+ const t = this.getAttribute("position"), e = this.getAttribute("previous"), s = this.getAttribute("next");
851
+ let n = 0, r = 0, a = 0;
852
+ const c = this._points[0];
853
+ e.setXYZ(r, c.x, c.y, c.z), r += 1, e.setXYZ(r, c.x, c.y, c.z), r += 1;
805
854
  for (let h = 0; h < this.pointCount; h++) {
806
855
  const i = this._points[h];
807
- e.setXYZ(s, i.x, i.y, i.z), s += 1, e.setXYZ(s, i.x, i.y, i.z), s += 1, h < this.pointCount - 1 && (t.setXYZ(o, i.x, i.y, i.z), o += 1, t.setXYZ(o, i.x, i.y, i.z), o += 1), h > 0 && h + 1 <= this.pointCount && (n.setXYZ(a, i.x, i.y, i.z), a += 1, n.setXYZ(a, i.x, i.y, i.z), a += 1);
856
+ t.setXYZ(n, i.x, i.y, i.z), n += 1, t.setXYZ(n, i.x, i.y, i.z), n += 1, h < this.pointCount - 1 && (e.setXYZ(r, i.x, i.y, i.z), r += 1, e.setXYZ(r, i.x, i.y, i.z), r += 1), h > 0 && h + 1 <= this.pointCount && (s.setXYZ(a, i.x, i.y, i.z), a += 1, s.setXYZ(a, i.x, i.y, i.z), a += 1);
808
857
  }
809
- const r = this._points[this.pointCount - 1];
810
- n.setXYZ(a, r.x, r.y, r.z), a += 1, n.setXYZ(a, r.x, r.y, r.z), a += 1, e.needsUpdate = !0, t.needsUpdate = !0, n.needsUpdate = !0, this.computeBoundingSphere(), this.computeBoundingBox();
858
+ const o = this._points[this.pointCount - 1];
859
+ s.setXYZ(a, o.x, o.y, o.z), a += 1, s.setXYZ(a, o.x, o.y, o.z), a += 1, t.needsUpdate = !0, e.needsUpdate = !0, s.needsUpdate = !0, this.computeBoundingSphere(), this.computeBoundingBox();
811
860
  }
812
861
  get points() {
813
862
  return this._points;
814
863
  }
815
- set points(e) {
816
- this.setPoints(e);
864
+ set points(t) {
865
+ this.setPoints(t);
817
866
  }
818
- updatePoints(e, t) {
819
- const n = this.convertToVector3Array(e);
820
- if (n.length !== this.pointCount) {
867
+ updatePoints(t, e) {
868
+ const s = this.convertToVector3Array(t);
869
+ if (s.length !== this.pointCount) {
821
870
  console.warn(
822
871
  "MeshLineGeometry: Cannot update points with different length. Use setPoints() instead."
823
872
  );
824
873
  return;
825
874
  }
826
- this._points = n, t && (this.shapeFunction = t, this.shape = "custom", this.initializeGeometry()), this.updateGeometry();
875
+ this._points = s, e && (this.shapeFunction = e, this.shape = "custom", this.initializeGeometry()), this.updateGeometry();
827
876
  }
828
- setShape(e, t) {
829
- this.shape = e, t && (this.shapeFunction = t), this._points.length > 0 && (this.initializeGeometry(), this.updateGeometry());
877
+ setShape(t, e) {
878
+ this.shape = t, e && (this.shapeFunction = e), this._points.length > 0 && (this.initializeGeometry(), this.updateGeometry());
830
879
  }
831
880
  }
832
- function nn(p, e) {
833
- const t = new Ne(), n = new Mt(), s = new Lt(), o = new _(), a = this.geometry;
834
- if (s.copy(a.boundingSphere), s.applyMatrix4(this.matrixWorld), !p.ray.intersectSphere(s, o)) return;
835
- t.copy(this.matrixWorld).invert(), n.copy(p.ray).applyMatrix4(t);
836
- const f = new _(), r = new _(), h = new _(), i = this instanceof We ? 2 : 1, c = a.index, g = a.attributes;
837
- if (c !== null) {
838
- const u = c.array, y = g.position.array, L = g.width.array;
839
- for (let S = 0, A = u.length - 1; S < A; S += i) {
840
- const C = u[S], v = u[S + 1];
841
- f.fromArray(y, C * 3), r.fromArray(y, v * 3);
842
- const j = L[Math.floor(S / 3)] !== void 0 ? L[Math.floor(S / 3)] : 1, ee = p.params.Line.threshold + this.material.lineWidth * j / 2, H = ee * ee;
843
- if (n.distanceSqToSegment(
844
- f,
845
- r,
881
+ function as(f, t) {
882
+ const e = new Ft(), s = new Ee(), n = new Ge(), r = new z(), a = this.geometry;
883
+ if (n.copy(a.boundingSphere), n.applyMatrix4(this.matrixWorld), !f.ray.intersectSphere(n, r)) return;
884
+ e.copy(this.matrixWorld).invert(), s.copy(f.ray).applyMatrix4(e);
885
+ const c = new z(), o = new z(), h = new z(), i = this instanceof qt ? 2 : 1, l = a.index, g = a.attributes;
886
+ if (l !== null) {
887
+ const d = l.array, y = g.position.array, A = g.width.array;
888
+ for (let x = 0, v = d.length - 1; x < v; x += i) {
889
+ const E = d[x], M = d[x + 1];
890
+ c.fromArray(y, E * 3), o.fromArray(y, M * 3);
891
+ const _ = A[Math.floor(x / 3)] !== void 0 ? A[Math.floor(x / 3)] : 1, R = f.params.Line.threshold + this.material.lineWidth * _ / 2, V = R * R;
892
+ if (s.distanceSqToSegment(
893
+ c,
846
894
  o,
895
+ r,
847
896
  h
848
- ) > H) continue;
849
- o.applyMatrix4(this.matrixWorld);
850
- const U = p.ray.origin.distanceTo(o);
851
- U < p.near || U > p.far || (e.push({
852
- distance: U,
897
+ ) > V) continue;
898
+ r.applyMatrix4(this.matrixWorld);
899
+ const j = f.ray.origin.distanceTo(r);
900
+ j < f.near || j > f.far || (t.push({
901
+ distance: j,
853
902
  // What do we want? intersection point on the ray or on the segment??
854
903
  // point: raycaster.ray.at( distance ),
855
904
  point: h.clone().applyMatrix4(this.matrixWorld),
856
- index: S,
905
+ index: x,
857
906
  face: null,
858
907
  faceIndex: void 0,
859
908
  object: this
860
- }), S = A);
909
+ }), x = v);
861
910
  }
862
911
  }
863
912
  }
864
- const be = (p) => {
865
- const { setPointWidth: e, nodes: t } = p, n = new Dt();
866
- return n.setPoints(t, e), n;
867
- }, He = /* @__PURE__ */ new WeakMap(), de = /* @__PURE__ */ new Map();
868
- let sn = class extends Z {
869
- constructor(e = {}) {
870
- super(), this.options = z({}, e);
913
+ const Mt = (f) => {
914
+ const { setPointWidth: t, nodes: e } = f, s = new Ne();
915
+ return s.setPoints(e, t), s;
916
+ }, Nt = /* @__PURE__ */ new WeakMap(), bt = /* @__PURE__ */ new Map();
917
+ let cs = class extends K {
918
+ constructor(t = {}) {
919
+ super(), this.options = O({}, t);
871
920
  }
872
921
  get material() {
873
- var e;
874
- return (e = this.object3d) == null ? void 0 : e.material;
922
+ var t;
923
+ return (t = this.object3d) == null ? void 0 : t.material;
875
924
  }
876
925
  create() {
877
- return oe(this, null, function* () {
926
+ return ct(this, null, function* () {
878
927
  const {
879
- nodes: e,
880
- nodesArr: t,
881
- geometry: n,
882
- geometryArr: s,
883
- material: o,
928
+ nodes: t,
929
+ nodesArr: e,
930
+ geometry: s,
931
+ geometryArr: n,
932
+ material: r,
884
933
  useGroups: a,
885
- setPointWidth: f,
886
- lineWidthArr: r,
934
+ setPointWidth: c,
935
+ lineWidthArr: o,
887
936
  materialParameters: h
888
937
  } = this.options;
889
- let i = o, c = n;
890
- !i && h && (i = this.getMaterial(h)), !c && e ? c = be({
891
- nodes: e,
892
- setPointWidth: f
893
- }) : !c && t ? c = V(
894
- t.map((g, u) => {
895
- let y = f;
896
- return !y && r && (y = () => {
897
- var L;
898
- return (L = r[u]) != null ? L : r[0];
899
- }), be({
938
+ let i = r, l = s;
939
+ !i && h && (i = this.getMaterial(h)), !l && t ? l = Mt({
940
+ nodes: t,
941
+ setPointWidth: c
942
+ }) : !l && e ? l = F(
943
+ e.map((g, d) => {
944
+ let y = c;
945
+ return !y && o && (y = () => {
946
+ var A;
947
+ return (A = o[d]) != null ? A : o[0];
948
+ }), Mt({
900
949
  nodes: g,
901
950
  setPointWidth: y
902
951
  });
903
952
  }),
904
953
  a != null ? a : 0
905
- ) : !c && s && s.length > 1 ? c = V(s, a != null ? a : 0) : !c && s && s.length === 1 && ([c] = s), this.createMesh(c, i);
954
+ ) : !l && n && n.length > 1 ? l = F(n, a != null ? a : 0) : !l && n && n.length === 1 && ([l] = n), this.createMesh(l, i);
906
955
  });
907
956
  }
908
- setGeometry(e, t) {
909
- const n = be({
910
- nodes: e,
911
- setPointWidth: t
912
- }), s = this.object3d, o = s.geometry;
913
- s.geometry = n, o.dispose();
914
- }
915
- getMaterial(e) {
916
- const { width: t, height: n } = this.pencil.getSize(), s = new st(z({
917
- color: new ke("#ffffff")
918
- }, e));
919
- return s.uniforms.resolution.value.set(t, n), s;
920
- }
921
- addGeometries(e) {
922
- const t = this.object3d, n = V([t.geometry, ...e]);
923
- t.geometry = n;
924
- }
925
- resize(e, t) {
926
- var n, s;
927
- (s = (n = this.material) == null ? void 0 : n.uniforms) == null || s.resolution.value.set(e, t);
928
- }
929
- handleMaterialChange(e) {
930
- if (e) {
931
- const { width: t, height: n } = this.pencil.getSize();
932
- this.resize(t, n);
957
+ setGeometry(t, e) {
958
+ const s = Mt({
959
+ nodes: t,
960
+ setPointWidth: e
961
+ }), n = this.object3d, r = n.geometry;
962
+ n.geometry = s, r.dispose();
963
+ }
964
+ getMaterial(t) {
965
+ const { width: e, height: s } = this.pencil.getSize(), n = new re(O({
966
+ color: new Yt("#ffffff")
967
+ }, t));
968
+ return n.uniforms.resolution.value.set(e, s), n;
969
+ }
970
+ addGeometries(t) {
971
+ const e = this.object3d, s = F([e.geometry, ...t]);
972
+ e.geometry = s;
973
+ }
974
+ resize(t, e) {
975
+ var s, n;
976
+ (n = (s = this.material) == null ? void 0 : s.uniforms) == null || n.resolution.value.set(t, e);
977
+ }
978
+ handleMaterialChange(t) {
979
+ if (t) {
980
+ const { width: e, height: s } = this.pencil.getSize();
981
+ this.resize(e, s);
933
982
  }
934
983
  }
935
984
  animate({
936
- duration: e = 1e3,
937
- delay: t = 0,
938
- repeat: n = 0,
939
- lineLoop: s,
940
- onRepeat: o,
985
+ duration: t = 1e3,
986
+ delay: e = 0,
987
+ repeat: s = 0,
988
+ lineLoop: n,
989
+ onRepeat: r,
941
990
  onUpdate: a,
942
- onComplete: f,
943
- startShow: r
991
+ onComplete: c,
992
+ startShow: o
944
993
  } = {}) {
945
- const { offset: h, offsetLoop: i } = this.material.uniforms, c = this.pencil.userData.debugLine ? de : He;
946
- if (c.get(this.material) && this.stopAnimation(), e === 0) return;
947
- const g = s != null ? s : !0;
948
- h.value.x = 1, i.value = g && r ? 1 : 0;
949
- let u = 0;
950
- const y = new ne.Tween(h.value).to({ x: -1 }, e).delay(t).repeat(n).onUpdate(({ x: L }) => {
951
- g && L <= 0 && i.value === 0 && (i.value = 1), a == null || a(L);
994
+ const { offset: h, offsetLoop: i } = this.material.uniforms, l = this.pencil.userData.debugLine ? bt : Nt;
995
+ if (l.get(this.material) && this.stopAnimation(), t === 0) return;
996
+ const g = n != null ? n : !0;
997
+ h.value.x = 1, i.value = g && o ? 1 : 0;
998
+ let d = 0;
999
+ const y = new ot.Tween(h.value).to({ x: -1 }, t).delay(e).repeat(s).onUpdate(({ x: A }) => {
1000
+ g && A <= 0 && i.value === 0 && (i.value = 1), a == null || a(A);
952
1001
  }).onRepeat(() => {
953
- u += 1, o == null || o(u);
1002
+ d += 1, r == null || r(d);
954
1003
  }).onComplete(() => {
955
- f == null || f();
1004
+ c == null || c();
956
1005
  }).start();
957
- c.set(this.material, y), this.material.addEventListener("dispose", () => {
1006
+ l.set(this.material, y), this.material.addEventListener("dispose", () => {
958
1007
  this.stopAnimation();
959
- }), this.pencil.userData.debugLine && console.log("animate", de.size);
1008
+ }), this.pencil.userData.debugLine && console.log("animate", bt.size);
960
1009
  }
961
1010
  stopAnimation() {
962
- const e = this.pencil.userData.debugLine ? de : He, t = e.get(this.material);
963
- t && (t.stop(), ne.remove(t), e.delete(this.material), this.material.uniforms.offset.value.x = 0, this.material.uniforms.offsetLoop.value = 1), this.pencil.userData.debugLine && console.log("stopAnimation", de.size);
1011
+ const t = this.pencil.userData.debugLine ? bt : Nt, e = t.get(this.material);
1012
+ e && (e.stop(), ot.remove(e), t.delete(this.material), this.material.uniforms.offset.value.x = 0, this.material.uniforms.offsetLoop.value = 1), this.pencil.userData.debugLine && console.log("stopAnimation", bt.size);
964
1013
  }
965
1014
  render() {
966
- const { width: e, height: t } = this.pencil.getSize();
967
- this.resize(e, t);
1015
+ const { width: t, height: e } = this.pencil.getSize();
1016
+ this.resize(t, e);
968
1017
  }
969
1018
  };
970
- const Xe = (p) => {
971
- const { points: e } = p, t = e.reduce((s, o, a) => (a < e.length - 1 && s.push(o, e[a + 1]), s), []);
972
- return new me().setFromPoints(t);
1019
+ const Xt = (f) => {
1020
+ const { points: t } = f, e = t.reduce((n, r, a) => (a < t.length - 1 && n.push(r, t[a + 1]), n), []);
1021
+ return new lt().setFromPoints(e);
973
1022
  };
974
- class rn extends Z {
975
- constructor(e = {}) {
976
- super(), this.options = z({}, e);
1023
+ class hs extends K {
1024
+ constructor(t = {}) {
1025
+ super(), this.options = O({}, t);
977
1026
  }
978
1027
  get material() {
979
- var e;
980
- return (e = this.object3d) == null ? void 0 : e.material;
1028
+ var t;
1029
+ return (t = this.object3d) == null ? void 0 : t.material;
981
1030
  }
982
1031
  create() {
983
- return oe(this, null, function* () {
1032
+ return ct(this, null, function* () {
984
1033
  const {
985
- points: e,
986
- pointsArr: t,
987
- geometry: n,
988
- geometryArr: s,
989
- material: o,
1034
+ points: t,
1035
+ pointsArr: e,
1036
+ geometry: s,
1037
+ geometryArr: n,
1038
+ material: r,
990
1039
  useGroups: a,
991
- setPointWidth: f,
992
- lineWidthArr: r,
1040
+ setPointWidth: c,
1041
+ lineWidthArr: o,
993
1042
  materialParameters: h,
994
1043
  instanceCount: i
995
1044
  } = this.options;
996
- let c = o, g = n;
997
- !c && h && (c = this.getMaterial(h)), !g && e ? g = Xe({
998
- points: e
999
- }) : !g && t ? g = V(
1000
- t.map((y) => Xe({
1045
+ let l = r, g = s;
1046
+ !l && h && (l = this.getMaterial(h)), !g && t ? g = Xt({
1047
+ points: t
1048
+ }) : !g && e ? g = F(
1049
+ e.map((y) => Xt({
1001
1050
  points: y
1002
1051
  })),
1003
1052
  a != null ? a : 0
1004
- ) : !g && s && s.length > 1 ? g = V(s, a != null ? a : 0) : !g && s && s.length === 1 && ([g] = s);
1005
- const u = new tt().fromLineSegments(
1006
- new We(g)
1053
+ ) : !g && n && n.length > 1 ? g = F(n, a != null ? a : 0) : !g && n && n.length === 1 && ([g] = n);
1054
+ const d = new ie().fromLineSegments(
1055
+ new qt(g)
1007
1056
  );
1008
1057
  if (this.pencil.options.WebGPUTHREE) {
1009
- i && (u.instanceCount = i);
1010
- const y = new it(u, c);
1058
+ i && (d.instanceCount = i);
1059
+ const y = new ae(d, l);
1011
1060
  y.computeLineDistances(), this.object3d = y;
1012
1061
  } else {
1013
- const y = new It(u, c);
1062
+ const y = new Re(d, l);
1014
1063
  y.computeLineDistances(), this.object3d = y;
1015
1064
  }
1016
1065
  });
1017
1066
  }
1018
- getMaterial(e) {
1019
- return new et(z({
1020
- color: new ke("#ffffff")
1021
- }, e));
1067
+ getMaterial(t) {
1068
+ return new ne(O({
1069
+ color: new Yt("#ffffff")
1070
+ }, t));
1022
1071
  }
1023
1072
  }
1024
- class an extends Z {
1025
- constructor(e) {
1026
- super(), this.objectType = "Node", this.onNodePointerIndex = [], this.options = z({
1027
- type: "2d"
1028
- }, e);
1073
+ class us {
1074
+ constructor(t = {}) {
1075
+ this.labels = /* @__PURE__ */ new Map(), this.lastUpdateTime = 0, this.isUpdating = !1, this.options = O({
1076
+ padding: 4,
1077
+ enabled: !0,
1078
+ throttleTime: 16,
1079
+ // ~60fps
1080
+ viewportMargin: 50
1081
+ }, t);
1029
1082
  }
1030
- create() {
1031
- const { position: e, children: t } = this.options, n = document.createElement("div");
1032
- this.element = n, t && n.appendChild(t), this.options.type === "3d" ? this.createCSS3DObject(n) : this.options.type === "3dSprite" ? this.createCSS3DSprite(n) : this.createCSS2DObject(n), e && this.object3d.position.copy(e);
1033
- }
1034
- setChildren(e) {
1035
- this.options.children = e, this.element.innerHTML = "", this.element.appendChild(e);
1036
- }
1037
- showAndEnsureVisible() {
1038
- const e = this.options.children;
1039
- e && (e.style.visibility = "hidden", this.show(), setTimeout(() => {
1040
- e.style.visibility = "", this.ensureVisible();
1041
- }));
1042
- }
1043
- moveElementToViewport() {
1044
- const e = this.options.children;
1045
- if (!e) return;
1046
- const t = e.getBoundingClientRect(), n = window.innerWidth, s = window.innerHeight;
1047
- let o = 0, a = 0;
1048
- t.left < 0 ? o = -t.left : t.right > n && (o = n - t.right), t.top < 0 ? a = -t.top : t.bottom > s && (a = s - t.bottom), t.left + o < 0 && (o = -t.left), t.top + a < 0 && (a = -t.top), (o !== 0 || a !== 0) && (e.style.transform = `translate(${o}px, ${a}px)`);
1049
- }
1050
- ensureVisible() {
1051
- const e = this.options.children;
1052
- if (!e) return;
1053
- e.style.transform && (e.style.transform = "");
1054
- const t = new IntersectionObserver((n) => {
1055
- n.forEach((s) => {
1056
- s.isIntersecting && (this.moveElementToViewport(), t.disconnect());
1083
+ /**
1084
+ * 添加标签到碰撞检测系统
1085
+ * @param node Node 实例
1086
+ * @param options 配置项,priority 越大越优先显示,不传则使用 node.options.priority
1087
+ */
1088
+ add(t, e = {}) {
1089
+ var s, n;
1090
+ this.labels.set(t, {
1091
+ node: t,
1092
+ priority: (n = (s = e.priority) != null ? s : t.options.priority) != null ? n : 0,
1093
+ visible: !0
1094
+ });
1095
+ }
1096
+ /**
1097
+ * 移除标签
1098
+ */
1099
+ remove(t) {
1100
+ this.labels.delete(t);
1101
+ }
1102
+ /**
1103
+ * 更新标签优先级
1104
+ */
1105
+ setPriority(t, e) {
1106
+ const s = this.labels.get(t);
1107
+ s && (s.priority = e);
1108
+ }
1109
+ /**
1110
+ * 批量添加标签
1111
+ */
1112
+ addBatch(t, e) {
1113
+ t.forEach((s, n) => {
1114
+ this.add(s, {
1115
+ priority: e ? e(s, n) : 0
1057
1116
  });
1058
1117
  });
1059
- t.observe(e);
1060
1118
  }
1061
- onPointerEvent(e, t) {
1062
- const n = this.lead.handlePickNode([this], e, t);
1063
- this.onNodePointerIndex.push(n);
1119
+ /**
1120
+ * 启用/禁用碰撞检测
1121
+ */
1122
+ setEnabled(t) {
1123
+ this.options.enabled = t, t || this.labels.forEach((e) => {
1124
+ this.setNodeVisibility(e.node, !0), e.visible = !0;
1125
+ });
1126
+ }
1127
+ /**
1128
+ * 更新碰撞检测(在渲染循环中调用)
1129
+ */
1130
+ update(t) {
1131
+ if (!this.options.enabled) return;
1132
+ const e = performance.now();
1133
+ e - this.lastUpdateTime < this.options.throttleTime || (this.lastUpdateTime = e, this.camera = t, !this.isUpdating && (this.isUpdating = !0, this.animationFrameId = requestAnimationFrame(() => {
1134
+ this.performCollisionDetection(), this.isUpdating = !1;
1135
+ })));
1136
+ }
1137
+ /**
1138
+ * 强制立即更新
1139
+ */
1140
+ forceUpdate() {
1141
+ this.camera && this.performCollisionDetection();
1142
+ }
1143
+ performCollisionDetection() {
1144
+ const { padding: t, viewportMargin: e } = this.options, s = window.innerWidth, n = window.innerHeight, r = [];
1145
+ this.labels.forEach((c) => {
1146
+ const o = c.node.element;
1147
+ if (!o) return;
1148
+ const h = o.style.display === "none";
1149
+ h && (o.style.visibility = "hidden", o.style.display = "");
1150
+ const i = o.getBoundingClientRect();
1151
+ h && (o.style.display = "none", o.style.visibility = ""), i.right >= -e && i.left <= s + e && i.bottom >= -e && i.top <= n + e ? (c.bounds = i, r.push(c)) : (this.setNodeVisibility(c.node, !1), c.visible = !1);
1152
+ }), r.sort((c, o) => o.priority - c.priority);
1153
+ const a = [];
1154
+ for (const c of r) {
1155
+ if (!c.bounds) continue;
1156
+ this.checkCollision(
1157
+ c.bounds,
1158
+ a,
1159
+ t
1160
+ ) ? (this.setNodeVisibility(c.node, !1), c.visible = !1) : (this.setNodeVisibility(c.node, !0), c.visible = !0, a.push(c.bounds));
1161
+ }
1162
+ }
1163
+ /**
1164
+ * 检测矩形是否与已占用区域碰撞
1165
+ */
1166
+ checkCollision(t, e, s) {
1167
+ for (const n of e)
1168
+ if (this.rectsIntersect(t, n, s))
1169
+ return !0;
1170
+ return !1;
1171
+ }
1172
+ /**
1173
+ * 检测两个矩形是否相交(包含 padding)
1174
+ */
1175
+ rectsIntersect(t, e, s) {
1176
+ return !(t.right + s < e.left || t.left - s > e.right || t.bottom + s < e.top || t.top - s > e.bottom);
1177
+ }
1178
+ /**
1179
+ * 设置节点可见性
1180
+ */
1181
+ setNodeVisibility(t, e) {
1182
+ const s = t.element;
1183
+ s && (e ? (s.style.display = "", s.style.opacity = "1") : s.style.display = "none");
1064
1184
  }
1185
+ /**
1186
+ * 获取当前可见的标签数量
1187
+ */
1188
+ getVisibleCount() {
1189
+ let t = 0;
1190
+ return this.labels.forEach((e) => {
1191
+ e.visible && t++;
1192
+ }), t;
1193
+ }
1194
+ /**
1195
+ * 获取所有标签数量
1196
+ */
1197
+ getTotalCount() {
1198
+ return this.labels.size;
1199
+ }
1200
+ /**
1201
+ * 清空所有标签
1202
+ */
1203
+ clear() {
1204
+ this.labels.clear();
1205
+ }
1206
+ /**
1207
+ * 销毁管理器
1208
+ */
1065
1209
  dispose() {
1066
- this.onNodePointerIndex.forEach((e) => {
1067
- this.lead.removePickNode(e);
1068
- }), super.dispose();
1210
+ this.animationFrameId && cancelAnimationFrame(this.animationFrameId), this.labels.clear();
1069
1211
  }
1070
1212
  }
1071
- class cn extends Z {
1072
- constructor(e) {
1073
- super(), this.options = z({
1213
+ class ds extends K {
1214
+ constructor(t) {
1215
+ super(), this.options = O({
1074
1216
  maxDepth: 10,
1075
1217
  percentDepth: !1,
1076
1218
  innerRadius: 25,
1077
1219
  outRadius: 42,
1078
1220
  activeIndex: -1
1079
- }, e);
1221
+ }, t);
1080
1222
  }
1081
1223
  create() {
1082
- return oe(this, null, function* () {
1224
+ return ct(this, null, function* () {
1083
1225
  this.createGroup();
1084
- const { data: e, maxDepth: t, colors: n, material: s, percentDepth: o, activeIndex: a } = this.options, f = Math.max(...e), r = e.reduce((i, c) => i + c, 0);
1226
+ const { data: t, maxDepth: e, colors: s, material: n, percentDepth: r, activeIndex: a } = this.options, c = Math.max(...t), o = t.reduce((i, l) => i + l, 0);
1085
1227
  let h = Math.PI / 2;
1086
- e.forEach((i, c) => {
1228
+ t.forEach((i, l) => {
1087
1229
  if (i === 0) return;
1088
- const g = Math.PI * 2 * (i / r), u = n[c], y = o ? t * (i / f) : t, L = this.createGeometry(y, g), S = s ? s.clone() : new Tt({
1089
- color: u
1230
+ const g = Math.PI * 2 * (i / o), d = s[l], y = r ? e * (i / c) : e, A = this.createGeometry(y, g), x = n ? n.clone() : new _e({
1231
+ color: d
1090
1232
  });
1091
- s && S.color.set(u);
1092
- const A = new Et(L, S);
1093
- A.userData.depth = y, A.userData.index = c, A.rotateZ(h), h += g, this.add(A);
1233
+ n && x.color.set(d);
1234
+ const v = new kt(A, x);
1235
+ v.userData.depth = y, v.userData.index = l, v.rotateZ(h), h += g, this.add(v);
1094
1236
  }), a !== -1 && this.setActive(a);
1095
1237
  });
1096
1238
  }
1097
- createGeometry(e, t) {
1098
- const { outRadius: n, innerRadius: s } = this.options, o = new we();
1099
- return o.moveTo(n, 0), o.lineTo(s, 0), o.absarc(0, 0, s, 0, t, !1), o.absarc(0, 0, n, t, 0, !0), new K(o, {
1239
+ createGeometry(t, e) {
1240
+ const { outRadius: s, innerRadius: n } = this.options, r = new St();
1241
+ return r.moveTo(s, 0), r.lineTo(n, 0), r.absarc(0, 0, n, 0, e, !1), r.absarc(0, 0, s, e, 0, !0), new nt(r, {
1100
1242
  curveSegments: 48,
1101
- depth: e,
1243
+ depth: t,
1102
1244
  bevelEnabled: !1
1103
1245
  });
1104
1246
  }
1105
- handlePick(e, t = 1.3) {
1106
- const { object: n } = this.pencil.pick(e, this.object3d.children) || {}, s = n ? this.object3d.children.findIndex((o) => o === n) : this.options.activeIndex;
1107
- return this.setActive(s, t);
1108
- }
1109
- setActive(e, t = 1.3) {
1110
- const n = this.object3d.children[e];
1111
- if (this.object3d.children.forEach((s) => {
1112
- if (!(n && n === s) && s.scale.z !== 1) {
1113
- if (s.userData.levTween) return;
1114
- s.userData.enTween && (s.userData.enTween.stop(), s.userData.enTween = null);
1115
- const o = new ne.Tween(s.scale).to({ z: 1 }, 100);
1116
- s.userData.levTween = o, o.start();
1247
+ handlePick(t, e = 1.3) {
1248
+ const { object: s } = this.pencil.pick(t, this.object3d.children) || {}, n = s ? this.object3d.children.findIndex((r) => r === s) : this.options.activeIndex;
1249
+ return this.setActive(n, e);
1250
+ }
1251
+ setActive(t, e = 1.3) {
1252
+ const s = this.object3d.children[t];
1253
+ if (this.object3d.children.forEach((n) => {
1254
+ if (!(s && s === n) && n.scale.z !== 1) {
1255
+ if (n.userData.levTween) return;
1256
+ n.userData.enTween && (n.userData.enTween.stop(), n.userData.enTween = null);
1257
+ const r = new ot.Tween(n.scale).to({ z: 1 }, 100);
1258
+ n.userData.levTween = r, r.start();
1117
1259
  }
1118
- }), n) {
1119
- if (n.userData.enTween)
1260
+ }), s) {
1261
+ if (s.userData.enTween)
1120
1262
  return;
1121
- n.userData.levTween && (n.userData.levTween.stop(), n.userData.levTween = null);
1122
- const s = new ne.Tween(n.scale).to({ z: t }, 100);
1123
- return n.userData.enTween = s, s.start(), n.userData.index;
1263
+ s.userData.levTween && (s.userData.levTween.stop(), s.userData.levTween = null);
1264
+ const n = new ot.Tween(s.scale).to({ z: e }, 100);
1265
+ return s.userData.enTween = n, n.start(), s.userData.index;
1124
1266
  }
1125
1267
  return -1;
1126
1268
  }
1127
1269
  render() {
1128
- this.object3d.scale.z = 0, new ne.Tween(this.object3d.scale).to({ z: 1 }, 1e3).easing(ne.Easing.Sinusoidal.InOut).start();
1270
+ this.object3d.scale.z = 0, new ot.Tween(this.object3d.scale).to({ z: 1 }, 1e3).easing(ot.Easing.Sinusoidal.InOut).start();
1129
1271
  }
1130
1272
  }
1131
1273
  export {
1132
- Jt as ConicPolygon,
1133
- Qt as ExtrudePolygon,
1134
- en as Group,
1135
- tn as Light,
1136
- sn as Line,
1137
- rn as Line2,
1138
- un as Line2Material,
1139
- dn as LineSegmentsGeometry,
1140
- Dt as MeshLineGeometry,
1141
- st as MeshLineMaterial,
1142
- nn as MeshLineRaycast,
1143
- an as Node,
1144
- cn as Pie,
1145
- nt as getConicPolygonGeometry,
1146
- pn as getConicPolygonGeometryMetas,
1147
- Kt as getSplitTexture
1274
+ us as CollisionManage,
1275
+ es as ConicPolygon,
1276
+ ss as Ellipsoid,
1277
+ ns as ExtrudePolygon,
1278
+ os as Group,
1279
+ rs as Light,
1280
+ cs as Line,
1281
+ hs as Line2,
1282
+ ps as Line2Material,
1283
+ ys as LineSegmentsGeometry,
1284
+ Ne as MeshLineGeometry,
1285
+ re as MeshLineMaterial,
1286
+ as as MeshLineRaycast,
1287
+ ws as Node,
1288
+ ds as Pie,
1289
+ oe as getConicPolygonGeometry,
1290
+ xs as getConicPolygonGeometryMetas,
1291
+ is as getSplitTexture
1148
1292
  };