gl-draw 0.17.0-beta.27 → 0.17.0-beta.29

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.
@@ -1,4 +1,3 @@
1
1
  export declare const ENTIRE_SCENE = 0;
2
2
  export declare const BLOOM_SCENE = 1;
3
- export declare const HIDE_SCENE = 2;
4
3
  export declare const IS_DEV: boolean;
@@ -1,15 +1,15 @@
1
- var Be = Object.defineProperty, Oe = Object.defineProperties;
2
- var De = Object.getOwnPropertyDescriptors;
1
+ var Oe = Object.defineProperty, De = Object.defineProperties;
2
+ var Te = Object.getOwnPropertyDescriptors;
3
3
  var W = Object.getOwnPropertySymbols;
4
4
  var se = Object.prototype.hasOwnProperty, re = Object.prototype.propertyIsEnumerable;
5
- var ne = Math.pow, ie = (n, e, t) => e in n ? Be(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, L = (n, e) => {
5
+ var ne = Math.pow, ie = (n, e, t) => e in n ? Oe(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, L = (n, e) => {
6
6
  for (var t in e || (e = {}))
7
7
  se.call(e, t) && ie(n, t, e[t]);
8
8
  if (W)
9
9
  for (var t of W(e))
10
10
  re.call(e, t) && ie(n, t, e[t]);
11
11
  return n;
12
- }, q = (n, e) => Oe(n, De(e));
12
+ }, q = (n, e) => De(n, Te(e));
13
13
  var oe = (n, e) => {
14
14
  var t = {};
15
15
  for (var i in n)
@@ -35,22 +35,22 @@ var ae = (n, e, t) => new Promise((i, s) => {
35
35
  }, r = (a) => a.done ? i(a.value) : Promise.resolve(a.value).then(o, c);
36
36
  r((t = t.apply(n, e)).next());
37
37
  });
38
- import { merge as J, mean as Te, extent as ce } from "d3-array";
39
- import Ee, { flatten as je } from "earcut";
40
- import { Material as le, Object3D as R, Texture as ue, BufferGeometry as ee, Float32BufferAttribute as G, PointsMaterial as ke, Points as te, InstancedMesh as Ce, Vector3 as S, Quaternion as ze, Group as Le, Mesh as Pe, Sprite as de, Box3 as Ae, ShaderMaterial as Ve, Vector2 as K, Color as he, Vector4 as V, Matrix4 as Ne, Line3 as We, Sphere as Ue, InstancedInterleavedBuffer as _e, InterleavedBufferAttribute as fe, MathUtils as Re } from "three";
41
- import Ge from "@turf/boolean-clockwise";
42
- import { p as pe, a as $e } from "./polar2Cartesian.module.js";
43
- import Fe from "delaunator";
44
- import qe from "@turf/boolean-point-in-polygon";
45
- import { geoBounds as Ie, geoContains as Ke, geoDistance as Qe, geoInterpolate as Xe } from "d3-geo";
46
- import { geoVoronoi as Ye } from "d3-geo-voronoi";
38
+ import { merge as H, mean as ke, extent as ce } from "d3-array";
39
+ import ze, { flatten as Ce } from "earcut";
40
+ import { Material as le, Object3D as R, Texture as ue, BufferGeometry as ee, Float32BufferAttribute as G, PointsMaterial as Ee, Points as te, InstancedMesh as Pe, Vector3 as S, Quaternion as Le, Group as Ve, Mesh as Ae, Sprite as de, Box3 as Ie, ShaderMaterial as Ne, Vector2 as K, Color as he, Vector4 as V, Matrix4 as We, Line3 as Ue, Sphere as _e, InstancedInterleavedBuffer as Re, InterleavedBufferAttribute as fe, MathUtils as Ge } from "three";
41
+ import $e from "@turf/boolean-clockwise";
42
+ import { p as pe, a as Fe } from "./polar2Cartesian.module.js";
43
+ import qe from "delaunator";
44
+ import Ke from "@turf/boolean-point-in-polygon";
45
+ import { geoBounds as Be, geoContains as Qe, geoDistance as Xe, geoInterpolate as Ye } from "d3-geo";
46
+ import { geoVoronoi as Ze } from "d3-geo-voronoi";
47
47
  import { scaleLinear as me } from "d3-scale";
48
- import { LineSegmentsGeometry as Ze } from "three/examples/jsm/lines/LineSegmentsGeometry";
48
+ import { LineSegmentsGeometry as Je } from "three/examples/jsm/lines/LineSegmentsGeometry";
49
49
  import { CSS2DObject as He } from "three/examples/jsm/renderers/CSS2DRenderer";
50
- import { CSS3DObject as Je, CSS3DSprite as et } from "three/examples/jsm/renderers/CSS3DRenderer";
50
+ import { CSS3DObject as et, CSS3DSprite as tt } from "three/examples/jsm/renderers/CSS3DRenderer";
51
51
  import "d3-geo-projection";
52
- const tt = 0, ve = 1, it = 2, Et = !1;
53
- class st {
52
+ const ve = 0, be = 1, Tt = !1;
53
+ class it {
54
54
  constructor() {
55
55
  this.resources = /* @__PURE__ */ new Set(), this.disposeMaterial = !0, this.disposeVideo = !0;
56
56
  }
@@ -91,7 +91,7 @@ class st {
91
91
  }), e.length = 0, this.resources.clear();
92
92
  }
93
93
  }
94
- const rt = (n, e = 1) => {
94
+ const st = (n, e = 1) => {
95
95
  const t = new ee();
96
96
  t.setAttribute(
97
97
  "position",
@@ -100,7 +100,7 @@ const rt = (n, e = 1) => {
100
100
  "scaleAtt",
101
101
  new G(new Array(e).fill(1), 1)
102
102
  );
103
- const i = n.material, s = new ke({
103
+ const i = n.material, s = new Ee({
104
104
  size: 10,
105
105
  map: i.map,
106
106
  alphaMap: i.alphaMap,
@@ -122,21 +122,21 @@ const rt = (n, e = 1) => {
122
122
  )}
123
123
  `;
124
124
  }, new te(t, s);
125
- }, nt = (n, e) => {
125
+ }, rt = (n, e) => {
126
126
  const t = new R();
127
127
  e.forEach((i, s) => {
128
128
  const o = pe(i.position), c = pe(i.scale || [1, 1, 1]);
129
129
  t.position.copy(o), t.scale.copy(c), t.updateMatrix();
130
130
  const r = t.matrix.clone();
131
- if (n instanceof Ce || n.isInstantiate)
131
+ if (n instanceof Pe || n.isInstantiate)
132
132
  n.setMatrixAt(s, r);
133
133
  else if (n instanceof te || n.type === "Points") {
134
- const l = n.geometry, m = l.attributes.position.array, u = l.attributes.scaleAtt.array, f = new S(), d = new S(), p = new ze(), h = s * 3, v = s * 1;
134
+ const l = n.geometry, m = l.attributes.position.array, u = l.attributes.scaleAtt.array, f = new S(), d = new S(), p = new Le(), h = s * 3, v = s * 1;
135
135
  r.decompose(f, p, d), m[h] = f.x, m[h + 1] = f.y, m[h + 2] = f.z, u[v] = Math.max(d.x, d.y, d.z), l.attributes.position.needsUpdate = !0, l.attributes.scaleAtt.needsUpdate = !0;
136
136
  }
137
137
  });
138
138
  };
139
- class ot {
139
+ class nt {
140
140
  constructor() {
141
141
  this.onPointerIndex = [];
142
142
  }
@@ -168,7 +168,7 @@ class ot {
168
168
  });
169
169
  }
170
170
  }
171
- class at extends ot {
171
+ class ot extends nt {
172
172
  constructor() {
173
173
  super(...arguments), this.userData = {}, this.materialList = {}, this.useMaterialType = "origin", this.disposeMaterialIfNotUsed = !0;
174
174
  }
@@ -226,7 +226,7 @@ class at extends ot {
226
226
  );
227
227
  }
228
228
  }
229
- class Z extends at {
229
+ class Z extends ot {
230
230
  constructor() {
231
231
  super(...arguments), this.key = "", this.objectType = "BaseObject", this.userData = {}, this.isPrefab = !1, this.isInstantiate = !1, this.isBloom = !1, this.isBaseObject = !0, this.disposeTrack = !0, this.isDispose = !1;
232
232
  }
@@ -276,20 +276,22 @@ class Z extends at {
276
276
  resize(e, t) {
277
277
  }
278
278
  show() {
279
- return this.object3d.visible = !0, this.object3d.traverse((e) => {
280
- e.layers.set(tt);
281
- }), this.isBloom && this.enableBloom(), this;
279
+ return this.object3d.visible = !0, this.traverse((e) => {
280
+ var t;
281
+ (t = e.object3d) == null || t.layers.disable(ve);
282
+ }), this;
282
283
  }
283
284
  hide() {
284
- return this.object3d.visible = !1, this.object3d.traverse((e) => {
285
- e.layers.set(it);
285
+ return this.object3d.visible = !1, this.traverse((e) => {
286
+ var t;
287
+ (t = e.object3d) == null || t.layers.enable(ve);
286
288
  }), this;
287
289
  }
288
290
  createGroup() {
289
- return this.object3d = new Le(), this;
291
+ return this.object3d = new Ve(), this;
290
292
  }
291
293
  createMesh(...e) {
292
- return this.object3d = new Pe(...e), this;
294
+ return this.object3d = new Ae(...e), this;
293
295
  }
294
296
  createPoints(...e) {
295
297
  return this.object3d = new te(...e), this;
@@ -298,10 +300,10 @@ class Z extends at {
298
300
  return this.object3d = new He(e), this;
299
301
  }
300
302
  createCSS3DObject(e) {
301
- return this.object3d = new Je(e), this;
303
+ return this.object3d = new et(e), this;
302
304
  }
303
305
  createCSS3DSprite(e) {
304
- return this.object3d = new et(e), this;
306
+ return this.object3d = new tt(e), this;
305
307
  }
306
308
  createSprite(e) {
307
309
  return this.object3d = new de(e), this;
@@ -312,7 +314,7 @@ class Z extends at {
312
314
  }), this;
313
315
  }
314
316
  getSize() {
315
- const e = new Ae().setFromObject(this.object3d);
317
+ const e = new Ie().setFromObject(this.object3d);
316
318
  return {
317
319
  min: e.min,
318
320
  max: e.max,
@@ -341,16 +343,16 @@ class Z extends at {
341
343
  if ((f = e == null ? void 0 : e.instancedAttr) != null && f.length) {
342
344
  const d = e.instancedAttr.length;
343
345
  if (this.object3d instanceof de)
344
- u.object3d = rt(this.object3d, d);
346
+ u.object3d = st(this.object3d, d);
345
347
  else {
346
348
  const p = this.object3d, h = i ? this.cloneMaterial() : p.material;
347
- u.object3d = new Ce(
349
+ u.object3d = new Pe(
348
350
  p.geometry,
349
351
  h,
350
352
  d
351
353
  );
352
354
  }
353
- nt(u.object3d, e == null ? void 0 : e.instancedAttr);
355
+ rt(u.object3d, e == null ? void 0 : e.instancedAttr);
354
356
  } else
355
357
  u.object3d = this.object3d.clone(!1), i && u.object3d.material && (u.object3d.material = this.cloneMaterial());
356
358
  u.object3d.userData.prefab && delete u.object3d.userData.prefab;
@@ -391,7 +393,7 @@ class Z extends at {
391
393
  });
392
394
  return;
393
395
  }
394
- this.object3d && ((i = this.pencil.composerController) == null || i.bloomSelection.add(this), this.object3d.layers.enable(ve)), (s = this.pencil.composerController) == null || s.checkBloomComposerActive(), this.isBloom = !0;
396
+ this.object3d && ((i = this.pencil.composerController) == null || i.bloomSelection.add(this), this.object3d.layers.enable(be)), (s = this.pencil.composerController) == null || s.checkBloomComposerActive(), this.isBloom = !0;
395
397
  }
396
398
  disableBloom(e = !0) {
397
399
  var t, i, s;
@@ -405,25 +407,25 @@ class Z extends at {
405
407
  });
406
408
  return;
407
409
  }
408
- this.object3d && ((i = this.pencil.composerController) == null || i.bloomSelection.delete(this), this.object3d.layers.disable(ve)), (s = this.pencil.composerController) == null || s.checkBloomComposerActive(), this.isBloom = !1;
410
+ this.object3d && ((i = this.pencil.composerController) == null || i.bloomSelection.delete(this), this.object3d.layers.disable(be)), (s = this.pencil.composerController) == null || s.checkBloomComposerActive(), this.isBloom = !1;
409
411
  }
410
412
  dispose() {
411
413
  var e, t;
412
414
  if (!this.isDispose && (this.isDispose = !0, super.dispose(), this.isBloom && (this.disableBloom(!1), (e = this.pencil.composerController) == null || e.checkBloomComposerActive()), (t = this.lead) == null || t.disableCursor(this), this.lead && (this.lead.objects.delete(this.key), this.lead.objectWrapChindIdMap.delete(this), this.object3d && this.lead.objMap.delete(this.object3d)), this.disposeTrack)) {
413
- const i = new st();
415
+ const i = new it();
414
416
  i.disposeMaterial = !1, i.track(this), i.dispose();
415
417
  }
416
418
  }
417
419
  }
418
- function ct(n, e) {
420
+ function at(n, e) {
419
421
  return n.map((t) => {
420
422
  const i = [];
421
423
  let s;
422
424
  return t.forEach((o) => {
423
425
  if (s) {
424
- const c = Qe(o, s) * 180 / Math.PI;
426
+ const c = Xe(o, s) * 180 / Math.PI;
425
427
  if (c > e) {
426
- const r = Xe(s, o), a = 1 / Math.ceil(c / e);
428
+ const r = Ye(s, o), a = 1 / Math.ceil(c / e);
427
429
  let l = a;
428
430
  for (; l < 1; )
429
431
  i.push(r(l)), l += a;
@@ -433,7 +435,7 @@ function ct(n, e) {
433
435
  }), i;
434
436
  });
435
437
  }
436
- function lt(n, { minLng: e, maxLng: t, minLat: i, maxLat: s } = {}) {
438
+ function ct(n, { minLng: e, maxLng: t, minLat: i, maxLat: s } = {}) {
437
439
  const o = Math.round(ne(360 / n, 2) / Math.PI), c = (1 + Math.sqrt(5)) / 2, r = (d) => d / c * 360 % 360 - 180, a = (d) => Math.acos(2 * d / o - 1) / Math.PI * 180 - 90, l = (d) => o * (Math.cos((d + 90) * Math.PI / 180) + 1) / 2, m = [
438
440
  s !== void 0 ? Math.ceil(l(s)) : 0,
439
441
  i !== void 0 ? Math.floor(l(i)) : o - 1
@@ -444,59 +446,59 @@ function lt(n, { minLng: e, maxLng: t, minLat: i, maxLat: s } = {}) {
444
446
  }
445
447
  return f;
446
448
  }
447
- function H(n, e, t = !1) {
448
- return t ? Ke(e, n) : qe(n, e);
449
+ function J(n, e, t = !1) {
450
+ return t ? Qe(e, n) : Ke(n, e);
449
451
  }
450
- function ut(n, e) {
451
- const t = { type: "Polygon", coordinates: n }, [[i, s], [o, c]] = Ie(t);
452
+ function lt(n, e) {
453
+ const t = { type: "Polygon", coordinates: n }, [[i, s], [o, c]] = Be(t);
452
454
  if (Math.min(Math.abs(o - i), Math.abs(c - s)) < e)
453
455
  return [];
454
456
  const r = i > o || c >= 89 || s <= -89;
455
- return lt(e, {
457
+ return ct(e, {
456
458
  minLng: i,
457
459
  maxLng: o,
458
460
  minLat: s,
459
461
  maxLat: c
460
462
  }).filter(
461
- (a) => H(a, t, r)
463
+ (a) => J(a, t, r)
462
464
  );
463
465
  }
464
- function dt(n, { resolution: e = 1 / 0, bbox: t, projection: i } = {}) {
465
- const s = ct(n, e), o = J(s), c = ut(n, e), r = [...o, ...c], a = { type: "Polygon", coordinates: n }, [[l, m], [u, f]] = Ie(a), d = l > u || // crosses antimeridian
466
+ function ut(n, { resolution: e = 1 / 0, bbox: t, projection: i } = {}) {
467
+ const s = at(n, e), o = H(s), c = lt(n, e), r = [...o, ...c], a = { type: "Polygon", coordinates: n }, [[l, m], [u, f]] = Be(a), d = l > u || // crosses antimeridian
466
468
  f >= 89 || // crosses north pole
467
469
  m <= -89;
468
470
  let p = [];
469
471
  if (d) {
470
- const y = Ye(r).triangles(), x = new Map(
471
- r.map(([A, I], k) => [`${A}-${I}`, k])
472
+ const y = Ze(r).triangles(), x = new Map(
473
+ r.map(([A, I], z) => [`${A}-${I}`, z])
472
474
  );
473
475
  y.features.forEach((A) => {
474
- const I = A.geometry.coordinates[0].slice(0, 3).reverse(), k = [];
476
+ const I = A.geometry.coordinates[0].slice(0, 3).reverse(), z = [];
475
477
  if (I.forEach(([B, F]) => {
476
478
  const N = `${B}-${F}`;
477
- x.has(N) && k.push(x.get(N));
478
- }), k.length === 3) {
479
- if (k.some((B) => B < o.length)) {
479
+ x.has(N) && z.push(x.get(N));
480
+ }), z.length === 3) {
481
+ if (z.some((B) => B < o.length)) {
480
482
  const B = A.properties.circumcenter;
481
- if (!H(
483
+ if (!J(
482
484
  B,
483
485
  a,
484
486
  d
485
487
  ))
486
488
  return;
487
489
  }
488
- p.push(...k);
490
+ p.push(...z);
489
491
  }
490
492
  });
491
493
  } else if (c.length) {
492
- const y = Fe.from(r);
494
+ const y = qe.from(r);
493
495
  for (let x = 0, A = y.triangles.length; x < A; x += 3) {
494
- const I = [2, 1, 0].map((B) => y.triangles[x + B]), k = I.map((B) => r[B]);
496
+ const I = [2, 1, 0].map((B) => y.triangles[x + B]), z = I.map((B) => r[B]);
495
497
  if (I.some((B) => B < o.length)) {
496
498
  const B = [0, 1].map(
497
- (F) => Te(k, (N) => N[F])
499
+ (F) => ke(z, (N) => N[F])
498
500
  );
499
- if (!H(
501
+ if (!J(
500
502
  B,
501
503
  a,
502
504
  d
@@ -506,8 +508,8 @@ function dt(n, { resolution: e = 1 / 0, bbox: t, projection: i } = {}) {
506
508
  p.push(...I);
507
509
  }
508
510
  } else {
509
- const { vertices: y, holes: x = [] } = je(s);
510
- p = Ee(y, x, 2);
511
+ const { vertices: y, holes: x = [] } = Ce(s);
512
+ p = ze(y, x, 2);
511
513
  }
512
514
  let h = t ? [t[0], t[2]] : ce(r, (y) => y[0]), v = t ? [t[1], t[3]] : ce(r, (y) => y[1]);
513
515
  if (i) {
@@ -523,7 +525,7 @@ function dt(n, { resolution: e = 1 / 0, bbox: t, projection: i } = {}) {
523
525
  });
524
526
  return { contour: s, triangles: { points: r, indices: p, uvs: O } };
525
527
  }
526
- const be = new ee().setAttribute ? "setAttribute" : "addAttribute";
528
+ const ye = new ee().setAttribute ? "setAttribute" : "addAttribute";
527
529
  function $(n, e, t, i) {
528
530
  const s = n.map(
529
531
  (o) => o.map(([c, r]) => {
@@ -531,12 +533,12 @@ function $(n, e, t, i) {
531
533
  const [a, l] = i([c, r]);
532
534
  return [a, -l, e];
533
535
  }
534
- return t ? $e(c, r, e) : [c, r, e];
536
+ return t ? Fe(c, r, e) : [c, r, e];
535
537
  })
536
538
  );
537
- return je(s);
539
+ return Ce(s);
538
540
  }
539
- function ht(n, e, t, i, s) {
541
+ function dt(n, e, t, i, s) {
540
542
  const { vertices: o, holes: c } = $(
541
543
  n,
542
544
  e,
@@ -547,7 +549,7 @@ function ht(n, e, t, i, s) {
547
549
  t,
548
550
  i,
549
551
  s
550
- ), a = J([r, o]), l = Math.round(r.length / 3), m = new Set(c);
552
+ ), a = H([r, o]), l = Math.round(r.length / 3), m = new Set(c);
551
553
  let u = 0;
552
554
  const f = [];
553
555
  for (let p = 0; p < l; p++) {
@@ -565,7 +567,7 @@ function ht(n, e, t, i, s) {
565
567
  for (let h = 0; h < l; h += 1) d.push(h / (l - 1), p);
566
568
  return { indices: f, vertices: a, uvs: d, topVerts: r };
567
569
  }
568
- function ye(n, e, t, i, s, o) {
570
+ function ge(n, e, t, i, s, o) {
569
571
  return {
570
572
  indices: i ? n.indices : n.indices.slice().reverse(),
571
573
  vertices: $(
@@ -577,7 +579,7 @@ function ye(n, e, t, i, s, o) {
577
579
  uvs: t
578
580
  };
579
581
  }
580
- const ft = ({
582
+ const ht = ({
581
583
  polygonGeoJson: n,
582
584
  startHeight: e,
583
585
  endHeight: t,
@@ -590,15 +592,15 @@ const ft = ({
590
592
  bbox: l
591
593
  }) => {
592
594
  n.forEach((j) => {
593
- Ge(j) || j.reverse();
595
+ $e(j) || j.reverse();
594
596
  });
595
- const { contour: m, triangles: u } = dt(n, {
597
+ const { contour: m, triangles: u } = ut(n, {
596
598
  resolution: i,
597
599
  bbox: l,
598
600
  projection: a
599
601
  });
600
602
  let f = {}, d;
601
- o && (f = ht(
603
+ o && (f = dt(
602
604
  m,
603
605
  e != null ? e : t,
604
606
  t != null ? t : e,
@@ -606,9 +608,9 @@ const ft = ({
606
608
  a
607
609
  ), d = f.topVerts);
608
610
  let p = [];
609
- (c || r) && (p = J(u.uvs));
611
+ (c || r) && (p = H(u.uvs));
610
612
  let h = {};
611
- c && (h = ye(
613
+ c && (h = ge(
612
614
  u,
613
615
  e,
614
616
  p,
@@ -617,7 +619,7 @@ const ft = ({
617
619
  a
618
620
  ));
619
621
  let v = {};
620
- return r && (v = ye(
622
+ return r && (v = ge(
621
623
  u,
622
624
  t,
623
625
  p,
@@ -649,7 +651,7 @@ class kt extends ee {
649
651
  cartesian: a,
650
652
  userDataRsoOffset: l,
651
653
  projection: m
652
- } = this.parameters, { contour: u, sideTorso: f, topVerts: d, bottomCap: p, topCap: h } = ft(L({}, this.parameters));
654
+ } = this.parameters, { contour: u, sideTorso: f, topVerts: d, bottomCap: p, topCap: h } = ht(L({}, this.parameters));
653
655
  let v = [], j = [], C = [], O = 0;
654
656
  const P = (y) => {
655
657
  const x = Math.round(v.length / 3), A = C.length;
@@ -662,10 +664,10 @@ class kt extends ee {
662
664
  i + l,
663
665
  a,
664
666
  m
665
- ).vertices : d), c && P(p), s && !o && P(h), this.setIndex(C), this[be]("position", new G(v, 3)), this[be]("uv", new G(j, 2)), this.computeVertexNormals();
667
+ ).vertices : d), c && P(p), s && !o && P(h), this.setIndex(C), this[ye]("position", new G(v, 3)), this[ye]("uv", new G(j, 2)), this.computeVertexNormals();
666
668
  }
667
669
  }
668
- const pt = `
670
+ const ft = `
669
671
  #include <fog_pars_fragment>
670
672
  #include <logdepthbuf_pars_fragment>
671
673
 
@@ -709,7 +711,7 @@ void main() {
709
711
  #include <tonemapping_fragment>
710
712
  #include <colorspace_fragment>
711
713
  }
712
- `, mt = `
714
+ `, pt = `
713
715
  #include <common>
714
716
  #include <logdepthbuf_pars_vertex>
715
717
  #include <fog_pars_vertex>
@@ -802,7 +804,7 @@ void main() {
802
804
  #include <fog_vertex>
803
805
  }
804
806
  `;
805
- class zt extends Ve {
807
+ class zt extends Ne {
806
808
  constructor(e = {}) {
807
809
  const C = e, {
808
810
  lineWidth: t = 1,
@@ -858,8 +860,8 @@ class zt extends Ve {
858
860
  useAlphaMap: { value: d ? 1 : 0 },
859
861
  repeat: { value: h }
860
862
  },
861
- vertexShader: mt,
862
- fragmentShader: pt
863
+ vertexShader: pt,
864
+ fragmentShader: ft
863
865
  })), this.type = "MeshLineMaterial";
864
866
  }
865
867
  // Getter and setter for color
@@ -910,20 +912,20 @@ class zt extends Ve {
910
912
  this.uniforms.sizeAttenuation.value = e ? 1 : 0;
911
913
  }
912
914
  }
913
- const Q = new V(), ge = new S(), Me = new S(), g = new V(), M = new V(), D = new V(), X = new S(), Y = new Ne(), w = new We(), we = new S(), U = new Ae(), _ = new Ue(), T = new V();
914
- let E, z;
915
- function xe(n, e, t) {
916
- return T.set(0, 0, -e, 1).applyMatrix4(n.projectionMatrix), T.multiplyScalar(1 / T.w), T.x = z / t.width, T.y = z / t.height, T.applyMatrix4(n.projectionMatrixInverse), T.multiplyScalar(1 / T.w), Math.abs(Math.max(T.x, T.y));
915
+ const Q = new V(), Me = new S(), we = new S(), g = new V(), M = new V(), D = new V(), X = new S(), Y = new We(), w = new Ue(), xe = new S(), U = new Ie(), _ = new _e(), T = new V();
916
+ let k, E;
917
+ function Se(n, e, t) {
918
+ return T.set(0, 0, -e, 1).applyMatrix4(n.projectionMatrix), T.multiplyScalar(1 / T.w), T.x = E / t.width, T.y = E / t.height, T.applyMatrix4(n.projectionMatrixInverse), T.multiplyScalar(1 / T.w), Math.abs(Math.max(T.x, T.y));
917
919
  }
918
- function vt(n, e) {
920
+ function mt(n, e) {
919
921
  const t = n.matrixWorld, i = n.geometry, s = i.attributes.instanceStart, o = i.attributes.instanceEnd, c = Math.min(i.instanceCount, s.count);
920
922
  for (let r = 0, a = c; r < a; r++) {
921
923
  w.start.fromBufferAttribute(s, r), w.end.fromBufferAttribute(o, r), w.applyMatrix4(t);
922
924
  const l = new S(), m = new S();
923
- E.distanceSqToSegment(w.start, w.end, m, l), m.distanceTo(l) < z * 0.5 && e.push({
925
+ k.distanceSqToSegment(w.start, w.end, m, l), m.distanceTo(l) < E * 0.5 && e.push({
924
926
  point: m,
925
927
  pointOnLine: l,
926
- distance: E.origin.distanceTo(m),
928
+ distance: k.origin.distanceTo(m),
927
929
  object: n,
928
930
  face: null,
929
931
  faceIndex: r,
@@ -932,9 +934,9 @@ function vt(n, e) {
932
934
  });
933
935
  }
934
936
  }
935
- function bt(n, e, t) {
937
+ function vt(n, e, t) {
936
938
  const i = e.projectionMatrix, o = n.material.resolution, c = n.matrixWorld, r = n.geometry, a = r.attributes.instanceStart, l = r.attributes.instanceEnd, m = Math.min(r.instanceCount, a.count), u = -e.near;
937
- E.at(1, D), D.w = 1, D.applyMatrix4(e.matrixWorldInverse), D.applyMatrix4(i), D.multiplyScalar(1 / D.w), D.x *= o.x / 2, D.y *= o.y / 2, D.z = 0, X.copy(D), Y.multiplyMatrices(e.matrixWorldInverse, c);
939
+ k.at(1, D), D.w = 1, D.applyMatrix4(e.matrixWorldInverse), D.applyMatrix4(i), D.multiplyScalar(1 / D.w), D.x *= o.x / 2, D.y *= o.y / 2, D.z = 0, X.copy(D), Y.multiplyMatrices(e.matrixWorldInverse, c);
938
940
  for (let f = 0, d = m; f < d; f++) {
939
941
  if (g.fromBufferAttribute(a, f), M.fromBufferAttribute(l, f), g.w = 1, M.w = 1, g.applyMatrix4(Y), M.applyMatrix4(Y), g.z > u && M.z > u)
940
942
  continue;
@@ -947,15 +949,15 @@ function bt(n, e, t) {
947
949
  }
948
950
  g.applyMatrix4(i), M.applyMatrix4(i), g.multiplyScalar(1 / g.w), M.multiplyScalar(1 / M.w), g.x *= o.x / 2, g.y *= o.y / 2, M.x *= o.x / 2, M.y *= o.y / 2, w.start.copy(g), w.start.z = 0, w.end.copy(M), w.end.z = 0;
949
951
  const h = w.closestPointToPointParameter(X, !0);
950
- w.at(h, we);
951
- const v = Re.lerp(g.z, M.z, h), j = v >= -1 && v <= 1, C = X.distanceTo(we) < z * 0.5;
952
+ w.at(h, xe);
953
+ const v = Ge.lerp(g.z, M.z, h), j = v >= -1 && v <= 1, C = X.distanceTo(xe) < E * 0.5;
952
954
  if (j && C) {
953
955
  w.start.fromBufferAttribute(a, f), w.end.fromBufferAttribute(l, f), w.start.applyMatrix4(c), w.end.applyMatrix4(c);
954
956
  const O = new S(), P = new S();
955
- E.distanceSqToSegment(w.start, w.end, P, O), t.push({
957
+ k.distanceSqToSegment(w.start, w.end, P, O), t.push({
956
958
  point: P,
957
959
  pointOnLine: O,
958
- distance: E.origin.distanceTo(P),
960
+ distance: k.origin.distanceTo(P),
959
961
  object: n,
960
962
  face: null,
961
963
  faceIndex: f,
@@ -965,16 +967,16 @@ function bt(n, e, t) {
965
967
  }
966
968
  }
967
969
  }
968
- class Lt extends Pe {
969
- constructor(e = new Ze(), t) {
970
+ class Et extends Ae {
971
+ constructor(e = new Je(), t) {
970
972
  super(e, t), this.isLineSegments2 = !0, this.type = "LineSegments2";
971
973
  }
972
974
  // for backwards-compatibility, but could be a method of LineSegmentsGeometry...
973
975
  computeLineDistances() {
974
976
  const e = this.geometry, t = e.attributes.instanceStart, i = e.attributes.instanceEnd, s = new Float32Array(2 * t.count);
975
977
  for (let c = 0, r = 0, a = t.count; c < a; c++, r += 2)
976
- ge.fromBufferAttribute(t, c), Me.fromBufferAttribute(i, c), s[r] = r === 0 ? 0 : s[r - 1], s[r + 1] = s[r] + ge.distanceTo(Me);
977
- const o = new _e(
978
+ Me.fromBufferAttribute(t, c), we.fromBufferAttribute(i, c), s[r] = r === 0 ? 0 : s[r - 1], s[r + 1] = s[r] + Me.distanceTo(we);
979
+ const o = new Re(
978
980
  s,
979
981
  2,
980
982
  1
@@ -993,41 +995,41 @@ class Lt extends Pe {
993
995
  'LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'
994
996
  );
995
997
  const o = e.params.Line2 !== void 0 && e.params.Line2.threshold || 0;
996
- E = e.ray;
998
+ k = e.ray;
997
999
  const c = this.matrixWorld, r = this.geometry, a = this.material;
998
- z = a.linewidth + o, r.boundingSphere === null && r.computeBoundingSphere(), _.copy(r.boundingSphere).applyMatrix4(c);
1000
+ E = a.linewidth + o, r.boundingSphere === null && r.computeBoundingSphere(), _.copy(r.boundingSphere).applyMatrix4(c);
999
1001
  let l;
1000
1002
  if (i)
1001
- l = z * 0.5;
1003
+ l = E * 0.5;
1002
1004
  else {
1003
1005
  const u = Math.max(
1004
1006
  s.near,
1005
- _.distanceToPoint(E.origin)
1007
+ _.distanceToPoint(k.origin)
1006
1008
  );
1007
- l = xe(
1009
+ l = Se(
1008
1010
  s,
1009
1011
  u,
1010
1012
  a.resolution
1011
1013
  );
1012
1014
  }
1013
- if (_.radius += l, E.intersectsSphere(_) === !1)
1015
+ if (_.radius += l, k.intersectsSphere(_) === !1)
1014
1016
  return;
1015
1017
  r.boundingBox === null && r.computeBoundingBox(), U.copy(r.boundingBox).applyMatrix4(c);
1016
1018
  let m;
1017
1019
  if (i)
1018
- m = z * 0.5;
1020
+ m = E * 0.5;
1019
1021
  else {
1020
1022
  const u = Math.max(
1021
1023
  s.near,
1022
- U.distanceToPoint(E.origin)
1024
+ U.distanceToPoint(k.origin)
1023
1025
  );
1024
- m = xe(
1026
+ m = Se(
1025
1027
  s,
1026
1028
  u,
1027
1029
  a.resolution
1028
1030
  );
1029
1031
  }
1030
- U.expandByScalar(m), E.intersectsBox(U) !== !1 && (i ? vt(this, t) : bt(this, s, t));
1032
+ U.expandByScalar(m), k.intersectsBox(U) !== !1 && (i ? mt(this, t) : vt(this, s, t));
1031
1033
  }
1032
1034
  onBeforeRender(e) {
1033
1035
  const t = this.material.uniforms;
@@ -1081,15 +1083,15 @@ const b = class b extends Z {
1081
1083
  }
1082
1084
  };
1083
1085
  b.observerMap = /* @__PURE__ */ new Map();
1084
- let Se = b;
1086
+ let je = b;
1085
1087
  export {
1086
- ve as B,
1087
- Et as I,
1088
- Lt as L,
1088
+ be as B,
1089
+ Tt as I,
1090
+ Et as L,
1089
1091
  zt as M,
1090
- Se as N,
1092
+ je as N,
1091
1093
  kt as P,
1092
- st as R,
1094
+ it as R,
1093
1095
  Z as a,
1094
- ft as g
1096
+ ht as g
1095
1097
  };
package/dist/index2.js CHANGED
@@ -1,7 +1,7 @@
1
- "use strict";var be=Object.defineProperty,ye=Object.defineProperties;var ge=Object.getOwnPropertyDescriptors;var U=Object.getOwnPropertySymbols;var ie=Object.prototype.hasOwnProperty,se=Object.prototype.propertyIsEnumerable;var re=Math.pow,te=(n,e,t)=>e in n?be(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,z=(n,e)=>{for(var t in e||(e={}))ie.call(e,t)&&te(n,t,e[t]);if(U)for(var t of U(e))se.call(e,t)&&te(n,t,e[t]);return n},$=(n,e)=>ye(n,ge(e));var ne=(n,e)=>{var t={};for(var i in n)ie.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&U)for(var i of U(n))e.indexOf(i)<0&&se.call(n,i)&&(t[i]=n[i]);return t};var oe=(n,e,t)=>new Promise((i,s)=>{var o=c=>{try{r(t.next(c))}catch(u){s(u)}},l=c=>{try{r(t.throw(c))}catch(u){s(u)}},r=c=>c.done?i(c.value):Promise.resolve(c.value).then(o,l);r((t=t.apply(n,e)).next())});const L=require("d3-array"),Y=require("earcut"),a=require("three"),Me=require("@turf/boolean-clockwise"),Z=require("./polar2Cartesian.js"),we=require("delaunator"),xe=require("@turf/boolean-point-in-polygon"),N=require("d3-geo"),Se=require("d3-geo-voronoi"),ae=require("d3-scale"),je=require("three/examples/jsm/lines/LineSegmentsGeometry"),Ce=require("three/examples/jsm/renderers/CSS2DRenderer"),ce=require("three/examples/jsm/renderers/CSS3DRenderer");require("d3-geo-projection");const Ae=0,H=1,Pe=2,Be=!1;class me{constructor(){this.resources=new Set,this.disposeMaterial=!0,this.disposeVideo=!0}track(e){if(!e)return e;if(Array.isArray(e))return e.forEach(t=>this.track(t)),e;if(!this.disposeMaterial&&e instanceof a.Material)return e;if(e instanceof R?(e.disposeTrack&&e.object3d?this.track(e.object3d):this.resources.add(e),Object.values(e.materialList).map(t=>this.track(t))):(e instanceof a.Object3D||Reflect.has(e,"dispose"))&&this.resources.add(e),e instanceof R)e.children.forEach(t=>{t.disposeTrack=!1}),this.track(e.children);else if(e instanceof a.Object3D){const t=e;this.track(t.geometry),this.track(t.material),this.track(t.children)}else if(e instanceof a.Material){for(const i of Object.values(e))i instanceof a.Texture&&this.track(i);const t=e;if(t.uniforms){for(const i of Object.values(t.uniforms))if(i){const s=i.value;(s instanceof a.Texture||Array.isArray(s))&&this.track(s)}}}else this.disposeVideo&&e.isVideoTexture&&e.source.data&&this.resources.add(e.source.data);return e}dispose(){const e=[];for(const t of this.resources)t instanceof a.Object3D?e.push(t):t instanceof HTMLVideoElement&&t.pause(),Reflect.has(t,"dispose")&&t.dispose();e.forEach(t=>{t.removeFromParent()}),e.length=0,this.resources.clear()}}const Ie=(n,e=1)=>{const t=new a.BufferGeometry;t.setAttribute("position",new a.Float32BufferAttribute(new Array(e*3).fill(0),3)),t.setAttribute("scaleAtt",new a.Float32BufferAttribute(new Array(e).fill(1),1));const i=n.material,s=new a.PointsMaterial({size:10,map:i.map,alphaMap:i.alphaMap,color:i.color,blending:i.blending,depthTest:i.depthTest,depthWrite:!1,opacity:i.opacity,transparent:!0,alphaTest:i.alphaTest,sizeAttenuation:!1});return s.onBeforeCompile=o=>{o.vertexShader=`
1
+ "use strict";var ye=Object.defineProperty,ge=Object.defineProperties;var Me=Object.getOwnPropertyDescriptors;var U=Object.getOwnPropertySymbols;var ie=Object.prototype.hasOwnProperty,se=Object.prototype.propertyIsEnumerable;var re=Math.pow,te=(n,e,t)=>e in n?ye(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,z=(n,e)=>{for(var t in e||(e={}))ie.call(e,t)&&te(n,t,e[t]);if(U)for(var t of U(e))se.call(e,t)&&te(n,t,e[t]);return n},$=(n,e)=>ge(n,Me(e));var ne=(n,e)=>{var t={};for(var i in n)ie.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&U)for(var i of U(n))e.indexOf(i)<0&&se.call(n,i)&&(t[i]=n[i]);return t};var oe=(n,e,t)=>new Promise((i,s)=>{var o=c=>{try{r(t.next(c))}catch(u){s(u)}},l=c=>{try{r(t.throw(c))}catch(u){s(u)}},r=c=>c.done?i(c.value):Promise.resolve(c.value).then(o,l);r((t=t.apply(n,e)).next())});const L=require("d3-array"),Y=require("earcut"),a=require("three"),we=require("@turf/boolean-clockwise"),Z=require("./polar2Cartesian.js"),xe=require("delaunator"),Se=require("@turf/boolean-point-in-polygon"),N=require("d3-geo"),je=require("d3-geo-voronoi"),ae=require("d3-scale"),Ce=require("three/examples/jsm/lines/LineSegmentsGeometry"),Ae=require("three/examples/jsm/renderers/CSS2DRenderer"),ce=require("three/examples/jsm/renderers/CSS3DRenderer");require("d3-geo-projection");const le=0,J=1,Pe=!1;class ve{constructor(){this.resources=new Set,this.disposeMaterial=!0,this.disposeVideo=!0}track(e){if(!e)return e;if(Array.isArray(e))return e.forEach(t=>this.track(t)),e;if(!this.disposeMaterial&&e instanceof a.Material)return e;if(e instanceof R?(e.disposeTrack&&e.object3d?this.track(e.object3d):this.resources.add(e),Object.values(e.materialList).map(t=>this.track(t))):(e instanceof a.Object3D||Reflect.has(e,"dispose"))&&this.resources.add(e),e instanceof R)e.children.forEach(t=>{t.disposeTrack=!1}),this.track(e.children);else if(e instanceof a.Object3D){const t=e;this.track(t.geometry),this.track(t.material),this.track(t.children)}else if(e instanceof a.Material){for(const i of Object.values(e))i instanceof a.Texture&&this.track(i);const t=e;if(t.uniforms){for(const i of Object.values(t.uniforms))if(i){const s=i.value;(s instanceof a.Texture||Array.isArray(s))&&this.track(s)}}}else this.disposeVideo&&e.isVideoTexture&&e.source.data&&this.resources.add(e.source.data);return e}dispose(){const e=[];for(const t of this.resources)t instanceof a.Object3D?e.push(t):t instanceof HTMLVideoElement&&t.pause(),Reflect.has(t,"dispose")&&t.dispose();e.forEach(t=>{t.removeFromParent()}),e.length=0,this.resources.clear()}}const Be=(n,e=1)=>{const t=new a.BufferGeometry;t.setAttribute("position",new a.Float32BufferAttribute(new Array(e*3).fill(0),3)),t.setAttribute("scaleAtt",new a.Float32BufferAttribute(new Array(e).fill(1),1));const i=n.material,s=new a.PointsMaterial({size:10,map:i.map,alphaMap:i.alphaMap,color:i.color,blending:i.blending,depthTest:i.depthTest,depthWrite:!1,opacity:i.opacity,transparent:!0,alphaTest:i.alphaTest,sizeAttenuation:!1});return s.onBeforeCompile=o=>{o.vertexShader=`
2
2
  attribute float scaleAtt;
3
3
  ${o.vertexShader.replace("gl_PointSize = size;","gl_PointSize = size * scaleAtt;")}
4
- `},new a.Points(t,s)},Oe=(n,e)=>{const t=new a.Object3D;e.forEach((i,s)=>{const o=Z.parseVector3(i.position),l=Z.parseVector3(i.scale||[1,1,1]);t.position.copy(o),t.scale.copy(l),t.updateMatrix();const r=t.matrix.clone();if(n instanceof a.InstancedMesh||n.isInstantiate)n.setMatrixAt(s,r);else if(n instanceof a.Points||n.type==="Points"){const u=n.geometry,v=u.attributes.position.array,d=u.attributes.scaleAtt.array,p=new a.Vector3,h=new a.Vector3,m=new a.Quaternion,f=s*3,b=s*1;r.decompose(p,m,h),v[f]=p.x,v[f+1]=p.y,v[f+2]=p.z,d[b]=Math.max(h.x,h.y,h.z),u.attributes.position.needsUpdate=!0,u.attributes.scaleAtt.needsUpdate=!0}})};class De{constructor(){this.onPointerIndex=[]}onPointerEvent(e,t){const i=this.lead.handlePick([this],e,t);this.onPointerIndex.push(i)}onClick(e){this.onPointerEvent("click",e)}onPointerEnter(e){this.onPointerEvent("enter",e)}onPointerEnterOnStop(e){this.onPointerEvent("enterOnStop",e)}onPointerLeave(e){this.onPointerEvent("leave",e)}onPointerMove(e){this.onPointerEvent("move",e)}onPointerDown(e){this.onPointerEvent("down",e)}dispose(){this.onPointerIndex.forEach(e=>{this.lead.removePick(e)})}}class Ve extends De{constructor(){super(...arguments),this.userData={},this.materialList={},this.useMaterialType="origin",this.disposeMaterialIfNotUsed=!0}cloneMaterial(){const e=this.object3d;if(!e||!e.material)return;const t=e.material;if(Array.isArray(t))return t.map(i=>{const s=i.userData;i.userData={};const o=i.clone();return i.userData=s,o});{const i=t.userData;t.userData={};const s=t.clone();return t.userData=i,s}}setMaterialList(e,t){const i=this.object3d;if(!i||!i.material)return;this.materialList.origin||(this.materialList.origin=i.material);const s=t==="clone"?this.cloneMaterial():Array.isArray(t)?t.slice():t;return this.materialList[e]=s,s}useMaterial(e){const t=this.object3d;!t||!t.material||this.useMaterialType===e||!this.materialList[e]||(this.useMaterialType=e,t.material=this.materialList[e])}useMListById(e,t){if(!this.mList)return;const i=this.mList.get(e);if(!i)return;const s=this.object3d;Array.isArray(s.material)&&t!==void 0?s.material[t]=i:s.material=i}useMListByName(e,t){if(!this.mList)return;const i=this.mList.getKeyByName(e);i&&this.useMListById(i,t)}dispose(){super.dispose(),this.mList.rmBaseObjectMap(this,void 0,this.disposeMaterialIfNotUsed)}}class R extends Ve{constructor(){super(...arguments),this.key="",this.objectType="BaseObject",this.userData={},this.isPrefab=!1,this.isInstantiate=!1,this.isBloom=!1,this.isBaseObject=!0,this.disposeTrack=!0,this.isDispose=!1}get parent(){const e=this.object3d.parent;return e&&this.lead.objMap.get(e)||null}get children(){return this.object3d.children.map(e=>this.lead.objMap.get(e)).filter(e=>!!e)}get position(){return this.object3d.position}get rotation(){return this.object3d.rotation}get scale(){return this.object3d.scale}lookAt(e){const t=e instanceof a.Vector3?e:new a.Vector3(...e);this.object3d.lookAt(t)}add(...e){[...e].forEach(t=>{this.lead.objMap.get(t)?this.object3d.add(t):this.lead.createBaseObject(t,{target:this})})}remove(...e){[...e].forEach(t=>{var i;this.lead.objMap.get(t)?(i=this.lead.objMap.get(t))==null||i.erase():this.object3d.remove(t)})}get visible(){return this.object3d.visible}create(){this.createGroup()}render(){}update(e,t){}resize(e,t){}show(){return this.object3d.visible=!0,this.object3d.traverse(e=>{e.layers.set(Ae)}),this.isBloom&&this.enableBloom(),this}hide(){return this.object3d.visible=!1,this.object3d.traverse(e=>{e.layers.set(Pe)}),this}createGroup(){return this.object3d=new a.Group,this}createMesh(...e){return this.object3d=new a.Mesh(...e),this}createPoints(...e){return this.object3d=new a.Points(...e),this}createCSS2DObject(e){return this.object3d=new Ce.CSS2DObject(e),this}createCSS3DObject(e){return this.object3d=new ce.CSS3DObject(e),this}createCSS3DSprite(e){return this.object3d=new ce.CSS3DSprite(e),this}createSprite(e){return this.object3d=new a.Sprite(e),this}attach(...e){return[...e].forEach(t=>{this.object3d.attach(t.object3d)}),this}getSize(){const e=new a.Box3().setFromObject(this.object3d);return{min:e.min,max:e.max,size:e.getSize(new a.Vector3),center:e.getCenter(new a.Vector3)}}setTop(e){this.object3d&&(this.object3d.renderOrder=e)}traverse(e){e(this),this.children.forEach(t=>{t.traverse(e)})}instantiate(e){return oe(this,null,function*(){var u,v;const t=(u=e==null?void 0:e.recursive)!=null?u:!0,i=(v=e==null?void 0:e.cloneMaterial)!=null?v:!1,{objectType:s,objectOptions:o}=this;let l=e==null?void 0:e.create,r,c=(e==null?void 0:e.target)||this.parent;return c===this.lead.prefabGroup&&(c=this.lead.group),this.objectType==="BaseObject"?r=this.lead.createBaseObject(this.object3d.clone(!1),{target:c}):(l===void 0&&(l=d=>{var p;if(this.object3d){if((p=e==null?void 0:e.instancedAttr)!=null&&p.length){const h=e.instancedAttr.length;if(this.object3d instanceof a.Sprite)d.object3d=Ie(this.object3d,h);else{const m=this.object3d,f=i?this.cloneMaterial():m.material;d.object3d=new a.InstancedMesh(m.geometry,f,h)}Oe(d.object3d,e==null?void 0:e.instancedAttr)}else d.object3d=this.object3d.clone(!1),i&&d.object3d.material&&(d.object3d.material=this.cloneMaterial());d.object3d.userData.prefab&&delete d.object3d.userData.prefab}}),r=yield this.lead.draw(s,$(z({},o||{}),{create:l,prefab:!1,keyType:this.keyType,key:(e==null?void 0:e.key)||this.keyName,uId:(e==null?void 0:e.uId)||this.keyUId,target:c}))),this.isBloom&&r.enableBloom(),t&&(yield Promise.all(this.children.map(d=>d.instantiate({key:d.keyUId&&d.keyName?`${d.keyName}-${d.keyUId}`:d.keyName,uId:e==null?void 0:e.uId,cloneMaterial:i,target:r})))),r.isInstantiate=!0,r})}erase(){this.lead.erase(this)}handleMaterialChange(e){}enableBloom(e=!0){var t,i,s;if(!((t=this.pencil.composerController)!=null&&t.bloomComposer)){console.warn("err:pencil.options.bloom");return}if(e){this.traverse(o=>{o.enableBloom(!1)});return}this.object3d&&((i=this.pencil.composerController)==null||i.bloomSelection.add(this),this.object3d.layers.enable(H)),(s=this.pencil.composerController)==null||s.checkBloomComposerActive(),this.isBloom=!0}disableBloom(e=!0){var t,i,s;if(!((t=this.pencil.composerController)!=null&&t.bloomComposer)){console.warn("err:pencil.options.bloom");return}if(e){this.traverse(o=>{o.disableBloom(!1)});return}this.object3d&&((i=this.pencil.composerController)==null||i.bloomSelection.delete(this),this.object3d.layers.disable(H)),(s=this.pencil.composerController)==null||s.checkBloomComposerActive(),this.isBloom=!1}dispose(){var e,t;if(!this.isDispose&&(this.isDispose=!0,super.dispose(),this.isBloom&&(this.disableBloom(!1),(e=this.pencil.composerController)==null||e.checkBloomComposerActive()),(t=this.lead)==null||t.disableCursor(this),this.lead&&(this.lead.objects.delete(this.key),this.lead.objectWrapChindIdMap.delete(this),this.object3d&&this.lead.objMap.delete(this.object3d)),this.disposeTrack)){const i=new me;i.disposeMaterial=!1,i.track(this),i.dispose()}}}function Te(n,e){return n.map(t=>{const i=[];let s;return t.forEach(o=>{if(s){const l=N.geoDistance(o,s)*180/Math.PI;if(l>e){const r=N.geoInterpolate(s,o),c=1/Math.ceil(l/e);let u=c;for(;u<1;)i.push(r(u)),u+=c}}i.push(s=o)}),i})}function Ee(n,{minLng:e,maxLng:t,minLat:i,maxLat:s}={}){const o=Math.round(re(360/n,2)/Math.PI),l=(1+Math.sqrt(5))/2,r=h=>h/l*360%360-180,c=h=>Math.acos(2*h/o-1)/Math.PI*180-90,u=h=>o*(Math.cos((h+90)*Math.PI/180)+1)/2,v=[s!==void 0?Math.ceil(u(s)):0,i!==void 0?Math.floor(u(i)):o-1],d=e===void 0&&t===void 0?()=>!0:e===void 0?h=>h<=t:t===void 0?h=>h>=e:t>=e?h=>h>=e&&h<=t:h=>h>=e||h<=t,p=[];for(let h=v[0];h<=v[1];h++){const m=r(h);d(m)&&p.push([m,c(h)])}return p}function J(n,e,t=!1){return t?N.geoContains(e,n):xe(n,e)}function ke(n,e){const t={type:"Polygon",coordinates:n},[[i,s],[o,l]]=N.geoBounds(t);if(Math.min(Math.abs(o-i),Math.abs(l-s))<e)return[];const r=i>o||l>=89||s<=-89;return Ee(e,{minLng:i,maxLng:o,minLat:s,maxLat:l}).filter(c=>J(c,t,r))}function ze(n,{resolution:e=1/0,bbox:t,projection:i}={}){const s=Te(n,e),o=L.merge(s),l=ke(n,e),r=[...o,...l],c={type:"Polygon",coordinates:n},[[u,v],[d,p]]=N.geoBounds(c),h=u>d||p>=89||v<=-89;let m=[];if(h){const g=Se.geoVoronoi(r).triangles(),S=new Map(r.map(([P,B],E)=>[`${P}-${B}`,E]));g.features.forEach(P=>{const B=P.geometry.coordinates[0].slice(0,3).reverse(),E=[];if(B.forEach(([I,F])=>{const W=`${I}-${F}`;S.has(W)&&E.push(S.get(W))}),E.length===3){if(E.some(I=>I<o.length)){const I=P.properties.circumcenter;if(!J(I,c,h))return}m.push(...E)}})}else if(l.length){const g=we.from(r);for(let S=0,P=g.triangles.length;S<P;S+=3){const B=[2,1,0].map(I=>g.triangles[S+I]),E=B.map(I=>r[I]);if(B.some(I=>I<o.length)){const I=[0,1].map(F=>L.mean(E,W=>W[F]));if(!J(I,c,h))continue}m.push(...B)}}else{const{vertices:g,holes:S=[]}=Y.flatten(s);m=Y(g,S,2)}let f=t?[t[0],t[2]]:L.extent(r,g=>g[0]),b=t?[t[1],t[3]]:L.extent(r,g=>g[1]);if(i){const[g,S]=i([f[0],b[0]]),[P,B]=i([f[1],b[1]]);f=[g,P],b=[-S,-B]}const j=ae.scaleLinear(f,[0,1]),C=ae.scaleLinear(b,[0,1]),O=r.map(([g,S])=>{if(i){const[P,B]=i([g,S]);return[j(P),C(-B)]}else return[j(g),C(S)]});return{contour:s,triangles:{points:r,indices:m,uvs:O}}}const le=new a.BufferGeometry().setAttribute?"setAttribute":"addAttribute";function q(n,e,t,i){const s=n.map(o=>o.map(([l,r])=>{if(i){const[c,u]=i([l,r]);return[c,-u,e]}return t?Z.polar2Cartesian(l,r,e):[l,r,e]}));return Y.flatten(s)}function Le(n,e,t,i,s){const{vertices:o,holes:l}=q(n,e,i,s),{vertices:r}=q(n,t,i,s),c=L.merge([r,o]),u=Math.round(r.length/3),v=new Set(l);let d=0;const p=[];for(let m=0;m<u;m++){let f=m+1;if(f===u)f=d;else if(v.has(f)){const b=f;f=d,d=b}p.push(m,m+u,f+u),p.push(f+u,f,m)}const h=[];for(let m=1;m>=0;m--)for(let f=0;f<u;f+=1)h.push(f/(u-1),m);return{indices:p,vertices:c,uvs:h,topVerts:r}}function ue(n,e,t,i,s,o){return{indices:i?n.indices:n.indices.slice().reverse(),vertices:q([n.points],e,s,o).vertices,uvs:t}}const ve=({polygonGeoJson:n,startHeight:e,endHeight:t,curvatureResolution:i=1,cartesian:s=!0,hasSide:o=!0,hasBottom:l=!1,hasTop:r=!1,projection:c,bbox:u})=>{n.forEach(j=>{Me(j)||j.reverse()});const{contour:v,triangles:d}=ze(n,{resolution:i,bbox:u,projection:c});let p={},h;o&&(p=Le(v,e!=null?e:t,t!=null?t:e,s,c),h=p.topVerts);let m=[];(l||r)&&(m=L.merge(d.uvs));let f={};l&&(f=ue(d,e,m,!1,s,c));let b={};return r&&(b=ue(d,t,m,!0,s,c)),{contour:v,triangles:d,sideTorso:p,bottomCap:f,topCap:b,topVerts:h}};class Ne extends a.BufferGeometry{constructor(e,t={}){super(),this.type="PolygonBufferGeometry",this.parameters=z({polygonGeoJson:e,startHeight:0,endHeight:1,hasTop:!0,topFirst:!1,hasBottom:!0,hasSide:!0,curvatureResolution:1,cartesian:!0,userDataRsoOffset:0},t);const{endHeight:i,hasTop:s,topFirst:o,hasBottom:l,hasSide:r,cartesian:c,userDataRsoOffset:u,projection:v}=this.parameters,{contour:d,sideTorso:p,topVerts:h,bottomCap:m,topCap:f}=ve(z({},this.parameters));let b=[],j=[],C=[],O=0;const A=g=>{const S=Math.round(b.length/3),P=C.length;b=b.concat(g.vertices),j=j.concat(g.uvs),C=C.concat(S?g.indices.map(B=>B+S):g.indices),this.addGroup(P,C.length-P,O++)};s&&o&&A(f),r&&(A(p),this.userData.topVerts=u?q(d,i+u,c,v).vertices:h),l&&A(m),s&&!o&&A(f),this.setIndex(C),this[le]("position",new a.Float32BufferAttribute(b,3)),this[le]("uv",new a.Float32BufferAttribute(j,2)),this.computeVertexNormals()}}const We=`
4
+ `},new a.Points(t,s)},Ie=(n,e)=>{const t=new a.Object3D;e.forEach((i,s)=>{const o=Z.parseVector3(i.position),l=Z.parseVector3(i.scale||[1,1,1]);t.position.copy(o),t.scale.copy(l),t.updateMatrix();const r=t.matrix.clone();if(n instanceof a.InstancedMesh||n.isInstantiate)n.setMatrixAt(s,r);else if(n instanceof a.Points||n.type==="Points"){const u=n.geometry,v=u.attributes.position.array,d=u.attributes.scaleAtt.array,p=new a.Vector3,h=new a.Vector3,m=new a.Quaternion,f=s*3,b=s*1;r.decompose(p,m,h),v[f]=p.x,v[f+1]=p.y,v[f+2]=p.z,d[b]=Math.max(h.x,h.y,h.z),u.attributes.position.needsUpdate=!0,u.attributes.scaleAtt.needsUpdate=!0}})};class Oe{constructor(){this.onPointerIndex=[]}onPointerEvent(e,t){const i=this.lead.handlePick([this],e,t);this.onPointerIndex.push(i)}onClick(e){this.onPointerEvent("click",e)}onPointerEnter(e){this.onPointerEvent("enter",e)}onPointerEnterOnStop(e){this.onPointerEvent("enterOnStop",e)}onPointerLeave(e){this.onPointerEvent("leave",e)}onPointerMove(e){this.onPointerEvent("move",e)}onPointerDown(e){this.onPointerEvent("down",e)}dispose(){this.onPointerIndex.forEach(e=>{this.lead.removePick(e)})}}class De extends Oe{constructor(){super(...arguments),this.userData={},this.materialList={},this.useMaterialType="origin",this.disposeMaterialIfNotUsed=!0}cloneMaterial(){const e=this.object3d;if(!e||!e.material)return;const t=e.material;if(Array.isArray(t))return t.map(i=>{const s=i.userData;i.userData={};const o=i.clone();return i.userData=s,o});{const i=t.userData;t.userData={};const s=t.clone();return t.userData=i,s}}setMaterialList(e,t){const i=this.object3d;if(!i||!i.material)return;this.materialList.origin||(this.materialList.origin=i.material);const s=t==="clone"?this.cloneMaterial():Array.isArray(t)?t.slice():t;return this.materialList[e]=s,s}useMaterial(e){const t=this.object3d;!t||!t.material||this.useMaterialType===e||!this.materialList[e]||(this.useMaterialType=e,t.material=this.materialList[e])}useMListById(e,t){if(!this.mList)return;const i=this.mList.get(e);if(!i)return;const s=this.object3d;Array.isArray(s.material)&&t!==void 0?s.material[t]=i:s.material=i}useMListByName(e,t){if(!this.mList)return;const i=this.mList.getKeyByName(e);i&&this.useMListById(i,t)}dispose(){super.dispose(),this.mList.rmBaseObjectMap(this,void 0,this.disposeMaterialIfNotUsed)}}class R extends De{constructor(){super(...arguments),this.key="",this.objectType="BaseObject",this.userData={},this.isPrefab=!1,this.isInstantiate=!1,this.isBloom=!1,this.isBaseObject=!0,this.disposeTrack=!0,this.isDispose=!1}get parent(){const e=this.object3d.parent;return e&&this.lead.objMap.get(e)||null}get children(){return this.object3d.children.map(e=>this.lead.objMap.get(e)).filter(e=>!!e)}get position(){return this.object3d.position}get rotation(){return this.object3d.rotation}get scale(){return this.object3d.scale}lookAt(e){const t=e instanceof a.Vector3?e:new a.Vector3(...e);this.object3d.lookAt(t)}add(...e){[...e].forEach(t=>{this.lead.objMap.get(t)?this.object3d.add(t):this.lead.createBaseObject(t,{target:this})})}remove(...e){[...e].forEach(t=>{var i;this.lead.objMap.get(t)?(i=this.lead.objMap.get(t))==null||i.erase():this.object3d.remove(t)})}get visible(){return this.object3d.visible}create(){this.createGroup()}render(){}update(e,t){}resize(e,t){}show(){return this.object3d.visible=!0,this.traverse(e=>{var t;(t=e.object3d)==null||t.layers.disable(le)}),this}hide(){return this.object3d.visible=!1,this.traverse(e=>{var t;(t=e.object3d)==null||t.layers.enable(le)}),this}createGroup(){return this.object3d=new a.Group,this}createMesh(...e){return this.object3d=new a.Mesh(...e),this}createPoints(...e){return this.object3d=new a.Points(...e),this}createCSS2DObject(e){return this.object3d=new Ae.CSS2DObject(e),this}createCSS3DObject(e){return this.object3d=new ce.CSS3DObject(e),this}createCSS3DSprite(e){return this.object3d=new ce.CSS3DSprite(e),this}createSprite(e){return this.object3d=new a.Sprite(e),this}attach(...e){return[...e].forEach(t=>{this.object3d.attach(t.object3d)}),this}getSize(){const e=new a.Box3().setFromObject(this.object3d);return{min:e.min,max:e.max,size:e.getSize(new a.Vector3),center:e.getCenter(new a.Vector3)}}setTop(e){this.object3d&&(this.object3d.renderOrder=e)}traverse(e){e(this),this.children.forEach(t=>{t.traverse(e)})}instantiate(e){return oe(this,null,function*(){var u,v;const t=(u=e==null?void 0:e.recursive)!=null?u:!0,i=(v=e==null?void 0:e.cloneMaterial)!=null?v:!1,{objectType:s,objectOptions:o}=this;let l=e==null?void 0:e.create,r,c=(e==null?void 0:e.target)||this.parent;return c===this.lead.prefabGroup&&(c=this.lead.group),this.objectType==="BaseObject"?r=this.lead.createBaseObject(this.object3d.clone(!1),{target:c}):(l===void 0&&(l=d=>{var p;if(this.object3d){if((p=e==null?void 0:e.instancedAttr)!=null&&p.length){const h=e.instancedAttr.length;if(this.object3d instanceof a.Sprite)d.object3d=Be(this.object3d,h);else{const m=this.object3d,f=i?this.cloneMaterial():m.material;d.object3d=new a.InstancedMesh(m.geometry,f,h)}Ie(d.object3d,e==null?void 0:e.instancedAttr)}else d.object3d=this.object3d.clone(!1),i&&d.object3d.material&&(d.object3d.material=this.cloneMaterial());d.object3d.userData.prefab&&delete d.object3d.userData.prefab}}),r=yield this.lead.draw(s,$(z({},o||{}),{create:l,prefab:!1,keyType:this.keyType,key:(e==null?void 0:e.key)||this.keyName,uId:(e==null?void 0:e.uId)||this.keyUId,target:c}))),this.isBloom&&r.enableBloom(),t&&(yield Promise.all(this.children.map(d=>d.instantiate({key:d.keyUId&&d.keyName?`${d.keyName}-${d.keyUId}`:d.keyName,uId:e==null?void 0:e.uId,cloneMaterial:i,target:r})))),r.isInstantiate=!0,r})}erase(){this.lead.erase(this)}handleMaterialChange(e){}enableBloom(e=!0){var t,i,s;if(!((t=this.pencil.composerController)!=null&&t.bloomComposer)){console.warn("err:pencil.options.bloom");return}if(e){this.traverse(o=>{o.enableBloom(!1)});return}this.object3d&&((i=this.pencil.composerController)==null||i.bloomSelection.add(this),this.object3d.layers.enable(J)),(s=this.pencil.composerController)==null||s.checkBloomComposerActive(),this.isBloom=!0}disableBloom(e=!0){var t,i,s;if(!((t=this.pencil.composerController)!=null&&t.bloomComposer)){console.warn("err:pencil.options.bloom");return}if(e){this.traverse(o=>{o.disableBloom(!1)});return}this.object3d&&((i=this.pencil.composerController)==null||i.bloomSelection.delete(this),this.object3d.layers.disable(J)),(s=this.pencil.composerController)==null||s.checkBloomComposerActive(),this.isBloom=!1}dispose(){var e,t;if(!this.isDispose&&(this.isDispose=!0,super.dispose(),this.isBloom&&(this.disableBloom(!1),(e=this.pencil.composerController)==null||e.checkBloomComposerActive()),(t=this.lead)==null||t.disableCursor(this),this.lead&&(this.lead.objects.delete(this.key),this.lead.objectWrapChindIdMap.delete(this),this.object3d&&this.lead.objMap.delete(this.object3d)),this.disposeTrack)){const i=new ve;i.disposeMaterial=!1,i.track(this),i.dispose()}}}function Ve(n,e){return n.map(t=>{const i=[];let s;return t.forEach(o=>{if(s){const l=N.geoDistance(o,s)*180/Math.PI;if(l>e){const r=N.geoInterpolate(s,o),c=1/Math.ceil(l/e);let u=c;for(;u<1;)i.push(r(u)),u+=c}}i.push(s=o)}),i})}function Te(n,{minLng:e,maxLng:t,minLat:i,maxLat:s}={}){const o=Math.round(re(360/n,2)/Math.PI),l=(1+Math.sqrt(5))/2,r=h=>h/l*360%360-180,c=h=>Math.acos(2*h/o-1)/Math.PI*180-90,u=h=>o*(Math.cos((h+90)*Math.PI/180)+1)/2,v=[s!==void 0?Math.ceil(u(s)):0,i!==void 0?Math.floor(u(i)):o-1],d=e===void 0&&t===void 0?()=>!0:e===void 0?h=>h<=t:t===void 0?h=>h>=e:t>=e?h=>h>=e&&h<=t:h=>h>=e||h<=t,p=[];for(let h=v[0];h<=v[1];h++){const m=r(h);d(m)&&p.push([m,c(h)])}return p}function H(n,e,t=!1){return t?N.geoContains(e,n):Se(n,e)}function Ee(n,e){const t={type:"Polygon",coordinates:n},[[i,s],[o,l]]=N.geoBounds(t);if(Math.min(Math.abs(o-i),Math.abs(l-s))<e)return[];const r=i>o||l>=89||s<=-89;return Te(e,{minLng:i,maxLng:o,minLat:s,maxLat:l}).filter(c=>H(c,t,r))}function ke(n,{resolution:e=1/0,bbox:t,projection:i}={}){const s=Ve(n,e),o=L.merge(s),l=Ee(n,e),r=[...o,...l],c={type:"Polygon",coordinates:n},[[u,v],[d,p]]=N.geoBounds(c),h=u>d||p>=89||v<=-89;let m=[];if(h){const g=je.geoVoronoi(r).triangles(),S=new Map(r.map(([P,B],E)=>[`${P}-${B}`,E]));g.features.forEach(P=>{const B=P.geometry.coordinates[0].slice(0,3).reverse(),E=[];if(B.forEach(([I,F])=>{const W=`${I}-${F}`;S.has(W)&&E.push(S.get(W))}),E.length===3){if(E.some(I=>I<o.length)){const I=P.properties.circumcenter;if(!H(I,c,h))return}m.push(...E)}})}else if(l.length){const g=xe.from(r);for(let S=0,P=g.triangles.length;S<P;S+=3){const B=[2,1,0].map(I=>g.triangles[S+I]),E=B.map(I=>r[I]);if(B.some(I=>I<o.length)){const I=[0,1].map(F=>L.mean(E,W=>W[F]));if(!H(I,c,h))continue}m.push(...B)}}else{const{vertices:g,holes:S=[]}=Y.flatten(s);m=Y(g,S,2)}let f=t?[t[0],t[2]]:L.extent(r,g=>g[0]),b=t?[t[1],t[3]]:L.extent(r,g=>g[1]);if(i){const[g,S]=i([f[0],b[0]]),[P,B]=i([f[1],b[1]]);f=[g,P],b=[-S,-B]}const j=ae.scaleLinear(f,[0,1]),C=ae.scaleLinear(b,[0,1]),O=r.map(([g,S])=>{if(i){const[P,B]=i([g,S]);return[j(P),C(-B)]}else return[j(g),C(S)]});return{contour:s,triangles:{points:r,indices:m,uvs:O}}}const ue=new a.BufferGeometry().setAttribute?"setAttribute":"addAttribute";function q(n,e,t,i){const s=n.map(o=>o.map(([l,r])=>{if(i){const[c,u]=i([l,r]);return[c,-u,e]}return t?Z.polar2Cartesian(l,r,e):[l,r,e]}));return Y.flatten(s)}function ze(n,e,t,i,s){const{vertices:o,holes:l}=q(n,e,i,s),{vertices:r}=q(n,t,i,s),c=L.merge([r,o]),u=Math.round(r.length/3),v=new Set(l);let d=0;const p=[];for(let m=0;m<u;m++){let f=m+1;if(f===u)f=d;else if(v.has(f)){const b=f;f=d,d=b}p.push(m,m+u,f+u),p.push(f+u,f,m)}const h=[];for(let m=1;m>=0;m--)for(let f=0;f<u;f+=1)h.push(f/(u-1),m);return{indices:p,vertices:c,uvs:h,topVerts:r}}function de(n,e,t,i,s,o){return{indices:i?n.indices:n.indices.slice().reverse(),vertices:q([n.points],e,s,o).vertices,uvs:t}}const be=({polygonGeoJson:n,startHeight:e,endHeight:t,curvatureResolution:i=1,cartesian:s=!0,hasSide:o=!0,hasBottom:l=!1,hasTop:r=!1,projection:c,bbox:u})=>{n.forEach(j=>{we(j)||j.reverse()});const{contour:v,triangles:d}=ke(n,{resolution:i,bbox:u,projection:c});let p={},h;o&&(p=ze(v,e!=null?e:t,t!=null?t:e,s,c),h=p.topVerts);let m=[];(l||r)&&(m=L.merge(d.uvs));let f={};l&&(f=de(d,e,m,!1,s,c));let b={};return r&&(b=de(d,t,m,!0,s,c)),{contour:v,triangles:d,sideTorso:p,bottomCap:f,topCap:b,topVerts:h}};class Le extends a.BufferGeometry{constructor(e,t={}){super(),this.type="PolygonBufferGeometry",this.parameters=z({polygonGeoJson:e,startHeight:0,endHeight:1,hasTop:!0,topFirst:!1,hasBottom:!0,hasSide:!0,curvatureResolution:1,cartesian:!0,userDataRsoOffset:0},t);const{endHeight:i,hasTop:s,topFirst:o,hasBottom:l,hasSide:r,cartesian:c,userDataRsoOffset:u,projection:v}=this.parameters,{contour:d,sideTorso:p,topVerts:h,bottomCap:m,topCap:f}=be(z({},this.parameters));let b=[],j=[],C=[],O=0;const A=g=>{const S=Math.round(b.length/3),P=C.length;b=b.concat(g.vertices),j=j.concat(g.uvs),C=C.concat(S?g.indices.map(B=>B+S):g.indices),this.addGroup(P,C.length-P,O++)};s&&o&&A(f),r&&(A(p),this.userData.topVerts=u?q(d,i+u,c,v).vertices:h),l&&A(m),s&&!o&&A(f),this.setIndex(C),this[ue]("position",new a.Float32BufferAttribute(b,3)),this[ue]("uv",new a.Float32BufferAttribute(j,2)),this.computeVertexNormals()}}const Ne=`
5
5
  #include <fog_pars_fragment>
6
6
  #include <logdepthbuf_pars_fragment>
7
7
 
@@ -45,7 +45,7 @@ void main() {
45
45
  #include <tonemapping_fragment>
46
46
  #include <colorspace_fragment>
47
47
  }
48
- `,Ue=`
48
+ `,We=`
49
49
  #include <common>
50
50
  #include <logdepthbuf_pars_vertex>
51
51
  #include <fog_pars_vertex>
@@ -137,4 +137,4 @@ void main() {
137
137
  #include <logdepthbuf_vertex>
138
138
  #include <fog_vertex>
139
139
  }
140
- `;class _e extends a.ShaderMaterial{constructor(e={}){const C=e,{lineWidth:t=1,color:i="#ffffff",opacity:s=1,map:o=null,dashOffset:l=0,dashArray:r=0,dashRatio:c=0,sizeAttenuation:u=!0,offsetLoop:v=!0,offset:d=new a.Vector2(0,0),scaleDown:p=0,alphaMap:h=void 0,alphaTest:m=0,repeat:f=new a.Vector2(1,1),resolution:b=new a.Vector2(1,1)}=C,j=ne(C,["lineWidth","color","opacity","map","dashOffset","dashArray","dashRatio","sizeAttenuation","offsetLoop","offset","scaleDown","alphaMap","alphaTest","repeat","resolution"]);super($(z({},j),{uniforms:{lineWidth:{value:t},color:{value:new a.Color(i)},opacity:{value:s},map:{value:o},useMap:{value:o?1:0},resolution:{value:b},sizeAttenuation:{value:u?1:0},offset:{value:d},offsetLoop:{value:v?1:0},dashArray:{value:r},dashOffset:{value:l},dashRatio:{value:c},useDash:{value:r>0?1:0},scaleDown:{value:p/10},alphaTest:{value:m},alphaMap:{value:h},useAlphaMap:{value:h?1:0},repeat:{value:f}},vertexShader:Ue,fragmentShader:We})),this.type="MeshLineMaterial"}get color(){return this.uniforms.color.value}set color(e){this.uniforms.color.value=new a.Color(e)}get opacity(){var e;return((e=this.uniforms)==null?void 0:e.opacity.value)||1}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get alphaTest(){return this.uniforms.alphaTest.value}set alphaTest(e){this.uniforms&&(this.uniforms.alphaTest.value=e)}get map(){return this.uniforms.map.value}set map(e){this.uniforms.map.value=e,this.uniforms.useMap.value=e?1:0}get repeat(){return this.uniforms.repeat.value}set repeat(e){this.uniforms.repeat.value.copy(e)}get lineWidth(){return this.uniforms.lineWidth.value}set lineWidth(e){this.uniforms.lineWidth.value=e}get sizeAttenuation(){return this.uniforms.sizeAttenuation.value===1}set sizeAttenuation(e){this.uniforms.sizeAttenuation.value=e?1:0}}const K=new a.Vector4,de=new a.Vector3,he=new a.Vector3,M=new a.Vector4,w=new a.Vector4,D=new a.Vector4,Q=new a.Vector3,X=new a.Matrix4,x=new a.Line3,fe=new a.Vector3,_=new a.Box3,G=new a.Sphere,V=new a.Vector4;let T,k;function pe(n,e,t){return V.set(0,0,-e,1).applyMatrix4(n.projectionMatrix),V.multiplyScalar(1/V.w),V.x=k/t.width,V.y=k/t.height,V.applyMatrix4(n.projectionMatrixInverse),V.multiplyScalar(1/V.w),Math.abs(Math.max(V.x,V.y))}function Ge(n,e){const t=n.matrixWorld,i=n.geometry,s=i.attributes.instanceStart,o=i.attributes.instanceEnd,l=Math.min(i.instanceCount,s.count);for(let r=0,c=l;r<c;r++){x.start.fromBufferAttribute(s,r),x.end.fromBufferAttribute(o,r),x.applyMatrix4(t);const u=new a.Vector3,v=new a.Vector3;T.distanceSqToSegment(x.start,x.end,v,u),v.distanceTo(u)<k*.5&&e.push({point:v,pointOnLine:u,distance:T.origin.distanceTo(v),object:n,face:null,faceIndex:r,uv:null,uv1:null})}}function Re(n,e,t){const i=e.projectionMatrix,o=n.material.resolution,l=n.matrixWorld,r=n.geometry,c=r.attributes.instanceStart,u=r.attributes.instanceEnd,v=Math.min(r.instanceCount,c.count),d=-e.near;T.at(1,D),D.w=1,D.applyMatrix4(e.matrixWorldInverse),D.applyMatrix4(i),D.multiplyScalar(1/D.w),D.x*=o.x/2,D.y*=o.y/2,D.z=0,Q.copy(D),X.multiplyMatrices(e.matrixWorldInverse,l);for(let p=0,h=v;p<h;p++){if(M.fromBufferAttribute(c,p),w.fromBufferAttribute(u,p),M.w=1,w.w=1,M.applyMatrix4(X),w.applyMatrix4(X),M.z>d&&w.z>d)continue;if(M.z>d){const O=M.z-w.z,A=(M.z-d)/O;M.lerp(w,A)}else if(w.z>d){const O=w.z-M.z,A=(w.z-d)/O;w.lerp(M,A)}M.applyMatrix4(i),w.applyMatrix4(i),M.multiplyScalar(1/M.w),w.multiplyScalar(1/w.w),M.x*=o.x/2,M.y*=o.y/2,w.x*=o.x/2,w.y*=o.y/2,x.start.copy(M),x.start.z=0,x.end.copy(w),x.end.z=0;const f=x.closestPointToPointParameter(Q,!0);x.at(f,fe);const b=a.MathUtils.lerp(M.z,w.z,f),j=b>=-1&&b<=1,C=Q.distanceTo(fe)<k*.5;if(j&&C){x.start.fromBufferAttribute(c,p),x.end.fromBufferAttribute(u,p),x.start.applyMatrix4(l),x.end.applyMatrix4(l);const O=new a.Vector3,A=new a.Vector3;T.distanceSqToSegment(x.start,x.end,A,O),t.push({point:A,pointOnLine:O,distance:T.origin.distanceTo(A),object:n,face:null,faceIndex:p,uv:null,uv1:null})}}}class qe extends a.Mesh{constructor(e=new je.LineSegmentsGeometry,t){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,i=e.attributes.instanceEnd,s=new Float32Array(2*t.count);for(let l=0,r=0,c=t.count;l<c;l++,r+=2)de.fromBufferAttribute(t,l),he.fromBufferAttribute(i,l),s[r]=r===0?0:s[r-1],s[r+1]=s[r]+de.distanceTo(he);const o=new a.InstancedInterleavedBuffer(s,2,1);return e.setAttribute("instanceDistanceStart",new a.InterleavedBufferAttribute(o,1,0)),e.setAttribute("instanceDistanceEnd",new a.InterleavedBufferAttribute(o,1,1)),this}raycast(e,t){const i=this.material.worldUnits,s=e.camera;s===null&&!i&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const o=e.params.Line2!==void 0&&e.params.Line2.threshold||0;T=e.ray;const l=this.matrixWorld,r=this.geometry,c=this.material;k=c.linewidth+o,r.boundingSphere===null&&r.computeBoundingSphere(),G.copy(r.boundingSphere).applyMatrix4(l);let u;if(i)u=k*.5;else{const d=Math.max(s.near,G.distanceToPoint(T.origin));u=pe(s,d,c.resolution)}if(G.radius+=u,T.intersectsSphere(G)===!1)return;r.boundingBox===null&&r.computeBoundingBox(),_.copy(r.boundingBox).applyMatrix4(l);let v;if(i)v=k*.5;else{const d=Math.max(s.near,_.distanceToPoint(T.origin));v=pe(s,d,c.resolution)}_.expandByScalar(v),T.intersectsBox(_)!==!1&&(i?Ge(this,t):Re(this,s,t))}onBeforeRender(e){const t=this.material.uniforms;t&&t.resolution&&(e.getViewport(K),this.material.uniforms.resolution.value.set(K.z,K.w))}}const y=class y extends R{constructor(e){super(),this.objectType="Node",this.onNodePointerIndex=[],this.options=z({type:"2d"},e)}create(){const{position:e,children:t}=this.options,i=document.createElement("div");this.element=i,t&&i.appendChild(t),this.options.type==="3d"?this.createCSS3DObject(i):this.options.type==="3dSprite"?this.createCSS3DSprite(i):this.createCSS2DObject(i),e&&this.object3d.position.copy(e)}setChildren(e){this.options.children=e,this.element.innerHTML="",this.element.appendChild(e)}showAndEnsureVisible(){const e=this.options.children;e&&(e.style.visibility="hidden",this.show(),setTimeout(()=>{e.style.visibility="",this.ensureVisible()}))}moveElementToViewport(){const e=this.options.children;if(!e)return;const t=e.getBoundingClientRect(),i=window.innerWidth,s=window.innerHeight,o=t.width,l=t.height;let r=0,c=0;o>i?t.left>0&&(r=-t.left):t.left<0?r=-t.left:t.right>i&&(r=i-t.right,t.left+r<0&&(r=-t.left)),l>s?t.top>0&&(c=-t.top):t.top<0?c=-t.top:t.bottom>s&&(c=s-t.bottom,t.top+c<0&&(c=-t.top)),(r!==0||c!==0)&&(e.style.transform=`translate(${r}px, ${c}px)`)}ensureVisible(){const e=this.options.children;e&&(e.style.transform&&(e.style.transform=""),!y.observerMap.has(e)&&(y.sharedObserver||(y.sharedObserver=new IntersectionObserver(t=>{t.forEach(i=>{const s=i.target,o=y.observerMap.get(s);o&&i.isIntersecting&&(o.moveElementToViewport(),y.observerMap.delete(s),y.sharedObserver&&(y.sharedObserver.unobserve(s),y.observerMap.size===0&&(y.sharedObserver.disconnect(),y.sharedObserver=void 0)))})})),y.observerMap.set(e,this),y.sharedObserver.observe(e)))}onPointerEvent(e,t){const i=this.lead.handlePickNode([this],e,t);this.onNodePointerIndex.push(i)}dispose(){const e=this.options.children;e&&y.sharedObserver&&(y.observerMap.delete(e),y.sharedObserver.unobserve(e),y.observerMap.size===0&&(y.sharedObserver.disconnect(),y.sharedObserver=void 0)),this.onNodePointerIndex.forEach(t=>{this.lead.removePickNode(t)}),super.dispose()}};y.observerMap=new Map;let ee=y;exports.BLOOM_SCENE=H;exports.BaseObject=R;exports.IS_DEV=Be;exports.LineSegments2=qe;exports.MeshLineMaterial=_e;exports.Node=ee;exports.PolygonGeometry=Ne;exports.ResourceTracker=me;exports.getMetas=ve;
140
+ `;class Ue extends a.ShaderMaterial{constructor(e={}){const C=e,{lineWidth:t=1,color:i="#ffffff",opacity:s=1,map:o=null,dashOffset:l=0,dashArray:r=0,dashRatio:c=0,sizeAttenuation:u=!0,offsetLoop:v=!0,offset:d=new a.Vector2(0,0),scaleDown:p=0,alphaMap:h=void 0,alphaTest:m=0,repeat:f=new a.Vector2(1,1),resolution:b=new a.Vector2(1,1)}=C,j=ne(C,["lineWidth","color","opacity","map","dashOffset","dashArray","dashRatio","sizeAttenuation","offsetLoop","offset","scaleDown","alphaMap","alphaTest","repeat","resolution"]);super($(z({},j),{uniforms:{lineWidth:{value:t},color:{value:new a.Color(i)},opacity:{value:s},map:{value:o},useMap:{value:o?1:0},resolution:{value:b},sizeAttenuation:{value:u?1:0},offset:{value:d},offsetLoop:{value:v?1:0},dashArray:{value:r},dashOffset:{value:l},dashRatio:{value:c},useDash:{value:r>0?1:0},scaleDown:{value:p/10},alphaTest:{value:m},alphaMap:{value:h},useAlphaMap:{value:h?1:0},repeat:{value:f}},vertexShader:We,fragmentShader:Ne})),this.type="MeshLineMaterial"}get color(){return this.uniforms.color.value}set color(e){this.uniforms.color.value=new a.Color(e)}get opacity(){var e;return((e=this.uniforms)==null?void 0:e.opacity.value)||1}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get alphaTest(){return this.uniforms.alphaTest.value}set alphaTest(e){this.uniforms&&(this.uniforms.alphaTest.value=e)}get map(){return this.uniforms.map.value}set map(e){this.uniforms.map.value=e,this.uniforms.useMap.value=e?1:0}get repeat(){return this.uniforms.repeat.value}set repeat(e){this.uniforms.repeat.value.copy(e)}get lineWidth(){return this.uniforms.lineWidth.value}set lineWidth(e){this.uniforms.lineWidth.value=e}get sizeAttenuation(){return this.uniforms.sizeAttenuation.value===1}set sizeAttenuation(e){this.uniforms.sizeAttenuation.value=e?1:0}}const K=new a.Vector4,he=new a.Vector3,fe=new a.Vector3,M=new a.Vector4,w=new a.Vector4,D=new a.Vector4,Q=new a.Vector3,X=new a.Matrix4,x=new a.Line3,pe=new a.Vector3,_=new a.Box3,G=new a.Sphere,V=new a.Vector4;let T,k;function me(n,e,t){return V.set(0,0,-e,1).applyMatrix4(n.projectionMatrix),V.multiplyScalar(1/V.w),V.x=k/t.width,V.y=k/t.height,V.applyMatrix4(n.projectionMatrixInverse),V.multiplyScalar(1/V.w),Math.abs(Math.max(V.x,V.y))}function _e(n,e){const t=n.matrixWorld,i=n.geometry,s=i.attributes.instanceStart,o=i.attributes.instanceEnd,l=Math.min(i.instanceCount,s.count);for(let r=0,c=l;r<c;r++){x.start.fromBufferAttribute(s,r),x.end.fromBufferAttribute(o,r),x.applyMatrix4(t);const u=new a.Vector3,v=new a.Vector3;T.distanceSqToSegment(x.start,x.end,v,u),v.distanceTo(u)<k*.5&&e.push({point:v,pointOnLine:u,distance:T.origin.distanceTo(v),object:n,face:null,faceIndex:r,uv:null,uv1:null})}}function Ge(n,e,t){const i=e.projectionMatrix,o=n.material.resolution,l=n.matrixWorld,r=n.geometry,c=r.attributes.instanceStart,u=r.attributes.instanceEnd,v=Math.min(r.instanceCount,c.count),d=-e.near;T.at(1,D),D.w=1,D.applyMatrix4(e.matrixWorldInverse),D.applyMatrix4(i),D.multiplyScalar(1/D.w),D.x*=o.x/2,D.y*=o.y/2,D.z=0,Q.copy(D),X.multiplyMatrices(e.matrixWorldInverse,l);for(let p=0,h=v;p<h;p++){if(M.fromBufferAttribute(c,p),w.fromBufferAttribute(u,p),M.w=1,w.w=1,M.applyMatrix4(X),w.applyMatrix4(X),M.z>d&&w.z>d)continue;if(M.z>d){const O=M.z-w.z,A=(M.z-d)/O;M.lerp(w,A)}else if(w.z>d){const O=w.z-M.z,A=(w.z-d)/O;w.lerp(M,A)}M.applyMatrix4(i),w.applyMatrix4(i),M.multiplyScalar(1/M.w),w.multiplyScalar(1/w.w),M.x*=o.x/2,M.y*=o.y/2,w.x*=o.x/2,w.y*=o.y/2,x.start.copy(M),x.start.z=0,x.end.copy(w),x.end.z=0;const f=x.closestPointToPointParameter(Q,!0);x.at(f,pe);const b=a.MathUtils.lerp(M.z,w.z,f),j=b>=-1&&b<=1,C=Q.distanceTo(pe)<k*.5;if(j&&C){x.start.fromBufferAttribute(c,p),x.end.fromBufferAttribute(u,p),x.start.applyMatrix4(l),x.end.applyMatrix4(l);const O=new a.Vector3,A=new a.Vector3;T.distanceSqToSegment(x.start,x.end,A,O),t.push({point:A,pointOnLine:O,distance:T.origin.distanceTo(A),object:n,face:null,faceIndex:p,uv:null,uv1:null})}}}class Re extends a.Mesh{constructor(e=new Ce.LineSegmentsGeometry,t){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,i=e.attributes.instanceEnd,s=new Float32Array(2*t.count);for(let l=0,r=0,c=t.count;l<c;l++,r+=2)he.fromBufferAttribute(t,l),fe.fromBufferAttribute(i,l),s[r]=r===0?0:s[r-1],s[r+1]=s[r]+he.distanceTo(fe);const o=new a.InstancedInterleavedBuffer(s,2,1);return e.setAttribute("instanceDistanceStart",new a.InterleavedBufferAttribute(o,1,0)),e.setAttribute("instanceDistanceEnd",new a.InterleavedBufferAttribute(o,1,1)),this}raycast(e,t){const i=this.material.worldUnits,s=e.camera;s===null&&!i&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const o=e.params.Line2!==void 0&&e.params.Line2.threshold||0;T=e.ray;const l=this.matrixWorld,r=this.geometry,c=this.material;k=c.linewidth+o,r.boundingSphere===null&&r.computeBoundingSphere(),G.copy(r.boundingSphere).applyMatrix4(l);let u;if(i)u=k*.5;else{const d=Math.max(s.near,G.distanceToPoint(T.origin));u=me(s,d,c.resolution)}if(G.radius+=u,T.intersectsSphere(G)===!1)return;r.boundingBox===null&&r.computeBoundingBox(),_.copy(r.boundingBox).applyMatrix4(l);let v;if(i)v=k*.5;else{const d=Math.max(s.near,_.distanceToPoint(T.origin));v=me(s,d,c.resolution)}_.expandByScalar(v),T.intersectsBox(_)!==!1&&(i?_e(this,t):Ge(this,s,t))}onBeforeRender(e){const t=this.material.uniforms;t&&t.resolution&&(e.getViewport(K),this.material.uniforms.resolution.value.set(K.z,K.w))}}const y=class y extends R{constructor(e){super(),this.objectType="Node",this.onNodePointerIndex=[],this.options=z({type:"2d"},e)}create(){const{position:e,children:t}=this.options,i=document.createElement("div");this.element=i,t&&i.appendChild(t),this.options.type==="3d"?this.createCSS3DObject(i):this.options.type==="3dSprite"?this.createCSS3DSprite(i):this.createCSS2DObject(i),e&&this.object3d.position.copy(e)}setChildren(e){this.options.children=e,this.element.innerHTML="",this.element.appendChild(e)}showAndEnsureVisible(){const e=this.options.children;e&&(e.style.visibility="hidden",this.show(),setTimeout(()=>{e.style.visibility="",this.ensureVisible()}))}moveElementToViewport(){const e=this.options.children;if(!e)return;const t=e.getBoundingClientRect(),i=window.innerWidth,s=window.innerHeight,o=t.width,l=t.height;let r=0,c=0;o>i?t.left>0&&(r=-t.left):t.left<0?r=-t.left:t.right>i&&(r=i-t.right,t.left+r<0&&(r=-t.left)),l>s?t.top>0&&(c=-t.top):t.top<0?c=-t.top:t.bottom>s&&(c=s-t.bottom,t.top+c<0&&(c=-t.top)),(r!==0||c!==0)&&(e.style.transform=`translate(${r}px, ${c}px)`)}ensureVisible(){const e=this.options.children;e&&(e.style.transform&&(e.style.transform=""),!y.observerMap.has(e)&&(y.sharedObserver||(y.sharedObserver=new IntersectionObserver(t=>{t.forEach(i=>{const s=i.target,o=y.observerMap.get(s);o&&i.isIntersecting&&(o.moveElementToViewport(),y.observerMap.delete(s),y.sharedObserver&&(y.sharedObserver.unobserve(s),y.observerMap.size===0&&(y.sharedObserver.disconnect(),y.sharedObserver=void 0)))})})),y.observerMap.set(e,this),y.sharedObserver.observe(e)))}onPointerEvent(e,t){const i=this.lead.handlePickNode([this],e,t);this.onNodePointerIndex.push(i)}dispose(){const e=this.options.children;e&&y.sharedObserver&&(y.observerMap.delete(e),y.sharedObserver.unobserve(e),y.observerMap.size===0&&(y.sharedObserver.disconnect(),y.sharedObserver=void 0)),this.onNodePointerIndex.forEach(t=>{this.lead.removePickNode(t)}),super.dispose()}};y.observerMap=new Map;let ee=y;exports.BLOOM_SCENE=J;exports.BaseObject=R;exports.IS_DEV=Pe;exports.LineSegments2=Re;exports.MeshLineMaterial=Ue;exports.Node=ee;exports.PolygonGeometry=Le;exports.ResourceTracker=ve;exports.getMetas=be;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gl-draw",
3
- "version": "0.17.0-beta.27",
3
+ "version": "0.17.0-beta.29",
4
4
  "author": "gitplus <hstits@gmail.com>",
5
5
  "scripts": {
6
6
  "start": "bundler-dev",