gl-draw 0.17.0-beta.3 → 0.17.0-beta.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants.d.ts +0 -1
- package/dist/core/BaseObject/PointerEvent.d.ts +1 -0
- package/dist/core/BaseObject/index.d.ts +4 -4
- package/dist/core/Composer.d.ts +5 -5
- package/dist/core/Helper.d.ts +4 -4
- package/dist/core/Lead/Pick.d.ts +35 -3
- package/dist/core/Lead/index.d.ts +5 -6
- package/dist/core/Pages/Pages.d.ts +1 -0
- package/dist/core/Pencil.d.ts +3 -3
- package/dist/core/pass/OutputPass.d.ts +1 -2
- package/dist/index.js +2 -2
- package/dist/index.module.js +501 -408
- package/dist/index.module2.js +1097 -0
- package/dist/index2.js +140 -0
- package/dist/objects/extrudePolygon/createGeometry.d.ts +2 -1
- package/dist/objects/group/index.d.ts +1 -0
- package/dist/objects/index.js +1 -1
- package/dist/objects/index.module.js +339 -379
- package/dist/objects/node/index.d.ts +4 -2
- package/dist/objects/pie/index.d.ts +2 -1
- package/dist/plugins/Worker/getAttributes/conicLine.d.ts +2 -3
- package/dist/plugins/Worker/getAttributes/conicPolygon.d.ts +2 -3
- package/dist/plugins/Worker/getAttributes/extrudePolygon.d.ts +2 -4
- package/dist/plugins/Worker/getAttributes/getCoordinatesArr.d.ts +5 -1
- package/dist/plugins/Worker/getAttributes/getMessage.d.ts +1 -1
- package/dist/plugins/Worker/getAttributes/line.d.ts +2 -2
- package/dist/plugins/Worker/getAttributes/line2.d.ts +2 -2
- package/dist/plugins/Worker/getAttributes/splitPolygonsByLongitudeDifference.d.ts +5 -2
- package/dist/plugins/Worker/index.d.ts +3 -3
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/index.module.js +77 -57
- package/package.json +1 -1
- package/dist/WebGPULineSegments2.js +0 -140
- package/dist/WebGPULineSegments2.module.js +0 -1031
|
@@ -2,7 +2,7 @@ var Je = Object.defineProperty, Qe = Object.defineProperties;
|
|
|
2
2
|
var Ke = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var he = Object.getOwnPropertySymbols;
|
|
4
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,
|
|
5
|
+
var Ie = (p, e, t) => e in p ? Je(p, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : p[e] = t, O = (p, e) => {
|
|
6
6
|
for (var t in e || (e = {}))
|
|
7
7
|
Be.call(e, t) && Ie(p, t, e[t]);
|
|
8
8
|
if (he)
|
|
@@ -19,66 +19,66 @@ var ye = (p, e) => {
|
|
|
19
19
|
e.indexOf(n) < 0 && Oe.call(p, n) && (t[n] = p[n]);
|
|
20
20
|
return t;
|
|
21
21
|
};
|
|
22
|
-
var
|
|
23
|
-
var
|
|
22
|
+
var ie = (p, e, t) => new Promise((n, s) => {
|
|
23
|
+
var r = (i) => {
|
|
24
24
|
try {
|
|
25
|
-
f(t.next(
|
|
25
|
+
f(t.next(i));
|
|
26
26
|
} catch (h) {
|
|
27
27
|
s(h);
|
|
28
28
|
}
|
|
29
|
-
}, a = (
|
|
29
|
+
}, a = (i) => {
|
|
30
30
|
try {
|
|
31
|
-
f(t.throw(
|
|
31
|
+
f(t.throw(i));
|
|
32
32
|
} catch (h) {
|
|
33
33
|
s(h);
|
|
34
34
|
}
|
|
35
|
-
}, f = (
|
|
35
|
+
}, f = (i) => i.done ? n(i.value) : Promise.resolve(i.value).then(r, a);
|
|
36
36
|
f((t = t.apply(p, e)).next());
|
|
37
37
|
});
|
|
38
38
|
import { LineMaterial as et } from "three/examples/jsm/lines/LineMaterial";
|
|
39
|
-
import { LineMaterial as
|
|
39
|
+
import { LineMaterial as hn } from "three/examples/jsm/lines/LineMaterial";
|
|
40
40
|
import { LineSegmentsGeometry as tt } from "three/examples/jsm/lines/LineSegmentsGeometry";
|
|
41
|
-
import { LineSegmentsGeometry as
|
|
42
|
-
import { P as nt, a as
|
|
43
|
-
import { g as pn } from "../
|
|
44
|
-
import { BufferGeometry as me, Float32BufferAttribute as xe, Vector3 as
|
|
45
|
-
import { mergeAttributes as
|
|
46
|
-
import { g as
|
|
47
|
-
import { Brush as
|
|
41
|
+
import { LineSegmentsGeometry as fn } from "three/examples/jsm/lines/LineSegmentsGeometry";
|
|
42
|
+
import { P as nt, a as K, M as st, L as ot } from "../index.module2.js";
|
|
43
|
+
import { N as mn, g as pn } from "../index.module2.js";
|
|
44
|
+
import { BufferGeometry as me, Float32BufferAttribute as xe, Vector3 as z, ShapeUtils as fe, Shape as we, Vector2 as E, ArcCurve as it, 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 We, BufferAttribute as Y, Ray as Mt, Sphere as Lt, LineSegments as Ne, Color as ke, MeshBasicMaterial as Tt, Mesh as Gt } from "three";
|
|
45
|
+
import { mergeAttributes as Ue, mergeGroups as _t } from "three/examples/jsm/utils/BufferGeometryUtils";
|
|
46
|
+
import { g as Et, c as Pt } from "../uvGenerator.module.js";
|
|
47
|
+
import { Brush as Re, Evaluator as zt, INTERSECTION as Ct } from "three-bvh-csg";
|
|
48
48
|
import { RectAreaLightUniformsLib as jt } from "three/examples/jsm/lights/RectAreaLightUniformsLib";
|
|
49
49
|
import * as ne from "@tweenjs/tween.js";
|
|
50
50
|
import { LineSegments2 as It } from "three/examples/jsm/lines/LineSegments2";
|
|
51
|
-
function
|
|
51
|
+
function H(p, e = 0) {
|
|
52
52
|
const t = p[0].index !== null, n = new Set(Object.keys(p[0].attributes)), s = new Set(
|
|
53
53
|
Object.keys(p[0].morphAttributes)
|
|
54
|
-
),
|
|
54
|
+
), r = {}, a = {}, f = p[0].morphTargetsRelative, i = new me();
|
|
55
55
|
let h = 0;
|
|
56
|
-
for (let
|
|
57
|
-
const c = p[
|
|
56
|
+
for (let o = 0; o < p.length; ++o) {
|
|
57
|
+
const c = p[o];
|
|
58
58
|
let g = 0;
|
|
59
59
|
if (t !== (c.index !== null))
|
|
60
60
|
return console.error(
|
|
61
|
-
"THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " +
|
|
61
|
+
"THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + o + ". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."
|
|
62
62
|
), null;
|
|
63
63
|
for (const u in c.attributes) {
|
|
64
64
|
if (!n.has(u))
|
|
65
65
|
return console.error(
|
|
66
|
-
"THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " +
|
|
66
|
+
"THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + o + '. All geometries must have compatible attributes; make sure "' + u + '" attribute exists among all geometries, or in none of them.'
|
|
67
67
|
), null;
|
|
68
|
-
|
|
68
|
+
r[u] === void 0 && (r[u] = []), r[u].push(c.attributes[u]), g++;
|
|
69
69
|
}
|
|
70
70
|
if (g !== n.size)
|
|
71
71
|
return console.error(
|
|
72
|
-
"THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " +
|
|
72
|
+
"THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + o + ". Make sure all geometries have the same number of attributes."
|
|
73
73
|
), null;
|
|
74
74
|
if (f !== c.morphTargetsRelative)
|
|
75
75
|
return console.error(
|
|
76
|
-
"THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " +
|
|
76
|
+
"THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + o + ". .morphTargetsRelative must be consistent throughout all geometries."
|
|
77
77
|
), null;
|
|
78
78
|
for (const u in c.morphAttributes) {
|
|
79
79
|
if (!s.has(u))
|
|
80
80
|
return console.error(
|
|
81
|
-
"THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " +
|
|
81
|
+
"THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + o + ". .morphAttributes must be consistent throughout all geometries."
|
|
82
82
|
), null;
|
|
83
83
|
a[u] === void 0 && (a[u] = []), a[u].push(c.morphAttributes[u]);
|
|
84
84
|
}
|
|
@@ -90,14 +90,14 @@ function V(p, e = 0) {
|
|
|
90
90
|
u = c.attributes.position.count;
|
|
91
91
|
else
|
|
92
92
|
return console.error(
|
|
93
|
-
"THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " +
|
|
93
|
+
"THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + o + ". The geometry must have either an index or a position attribute"
|
|
94
94
|
), null;
|
|
95
95
|
if (e === 1)
|
|
96
|
-
|
|
96
|
+
i.addGroup(h, u, o);
|
|
97
97
|
else if (e === 2 && c.groups.length > 0)
|
|
98
98
|
for (let y of c.groups) {
|
|
99
99
|
let L = y.materialIndex;
|
|
100
|
-
|
|
100
|
+
i.addGroup(
|
|
101
101
|
h + y.start,
|
|
102
102
|
Math.min(y.count, u),
|
|
103
103
|
L
|
|
@@ -107,62 +107,62 @@ function V(p, e = 0) {
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
if (t) {
|
|
110
|
-
let
|
|
110
|
+
let o = 0;
|
|
111
111
|
const c = [];
|
|
112
112
|
for (let g = 0; g < p.length; ++g) {
|
|
113
113
|
const u = p[g].index;
|
|
114
114
|
for (let y = 0; y < u.count; ++y)
|
|
115
|
-
c.push(u.getX(y) +
|
|
116
|
-
|
|
115
|
+
c.push(u.getX(y) + o);
|
|
116
|
+
o += p[g].attributes.position.count;
|
|
117
117
|
}
|
|
118
|
-
|
|
118
|
+
i.setIndex(c);
|
|
119
119
|
}
|
|
120
|
-
for (const
|
|
121
|
-
const c =
|
|
120
|
+
for (const o in r) {
|
|
121
|
+
const c = Ue(r[o]);
|
|
122
122
|
if (!c)
|
|
123
123
|
return console.error(
|
|
124
|
-
"THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the " +
|
|
124
|
+
"THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the " + o + " attribute."
|
|
125
125
|
), null;
|
|
126
|
-
|
|
126
|
+
i.setAttribute(o, c);
|
|
127
127
|
}
|
|
128
|
-
for (const
|
|
129
|
-
const c = a[
|
|
128
|
+
for (const o in a) {
|
|
129
|
+
const c = a[o][0].length;
|
|
130
130
|
if (c === 0) break;
|
|
131
|
-
|
|
131
|
+
i.morphAttributes = i.morphAttributes || {}, i.morphAttributes[o] = [];
|
|
132
132
|
for (let g = 0; g < c; ++g) {
|
|
133
133
|
const u = [];
|
|
134
|
-
for (let L = 0; L < a[
|
|
135
|
-
u.push(a[
|
|
136
|
-
const y =
|
|
134
|
+
for (let L = 0; L < a[o].length; ++L)
|
|
135
|
+
u.push(a[o][L][g]);
|
|
136
|
+
const y = Ue(u);
|
|
137
137
|
if (!y)
|
|
138
138
|
return console.error(
|
|
139
|
-
"THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the " +
|
|
139
|
+
"THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the " + o + " morphAttribute."
|
|
140
140
|
), null;
|
|
141
|
-
|
|
141
|
+
i.morphAttributes[o].push(y);
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
|
-
return e === 2 ?
|
|
144
|
+
return e === 2 ? _t(i) : i;
|
|
145
145
|
}
|
|
146
146
|
const De = (p) => {
|
|
147
147
|
const f = p, { coordinate: e, startHeight: t, height: n } = f, s = ye(f, ["coordinate", "startHeight", "height"]);
|
|
148
|
-
let
|
|
149
|
-
return typeof t != "undefined" && typeof n != "undefined" && (
|
|
148
|
+
let r = t || 0;
|
|
149
|
+
return typeof t != "undefined" && typeof n != "undefined" && (r = t + n), new nt([e], ue(O({}, s), {
|
|
150
150
|
startHeight: t,
|
|
151
|
-
endHeight:
|
|
151
|
+
endHeight: r
|
|
152
152
|
}));
|
|
153
153
|
};
|
|
154
|
-
class Jt extends
|
|
154
|
+
class Jt extends K {
|
|
155
155
|
constructor(e) {
|
|
156
|
-
super(), this.options =
|
|
156
|
+
super(), this.options = O({}, e);
|
|
157
157
|
}
|
|
158
158
|
create() {
|
|
159
|
-
const
|
|
159
|
+
const i = this.options, {
|
|
160
160
|
geometry: e,
|
|
161
161
|
coordinateArr: t,
|
|
162
162
|
coordinate: n,
|
|
163
163
|
material: s,
|
|
164
|
-
useGroups:
|
|
165
|
-
} =
|
|
164
|
+
useGroups: r
|
|
165
|
+
} = i, a = ye(i, [
|
|
166
166
|
"geometry",
|
|
167
167
|
"coordinateArr",
|
|
168
168
|
"coordinate",
|
|
@@ -171,22 +171,22 @@ class Jt extends Z {
|
|
|
171
171
|
]);
|
|
172
172
|
let f = e;
|
|
173
173
|
if (!f && n)
|
|
174
|
-
f = De(
|
|
174
|
+
f = De(O({
|
|
175
175
|
coordinate: n
|
|
176
176
|
}, a));
|
|
177
177
|
else if (!f && t) {
|
|
178
178
|
const h = t.map(
|
|
179
|
-
(
|
|
180
|
-
coordinate:
|
|
179
|
+
(o) => De(O({
|
|
180
|
+
coordinate: o
|
|
181
181
|
}, a))
|
|
182
182
|
);
|
|
183
|
-
f =
|
|
183
|
+
f = H(h, r != null ? r : 0);
|
|
184
184
|
}
|
|
185
185
|
this.createMesh(f, s);
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
188
|
const Bt = {
|
|
189
|
-
ArcCurve:
|
|
189
|
+
ArcCurve: it,
|
|
190
190
|
CatmullRomCurve3: rt,
|
|
191
191
|
CubicBezierCurve: at,
|
|
192
192
|
CubicBezierCurve3: ct,
|
|
@@ -197,7 +197,7 @@ const Bt = {
|
|
|
197
197
|
QuadraticBezierCurve3: dt,
|
|
198
198
|
SplineCurve: mt
|
|
199
199
|
};
|
|
200
|
-
class
|
|
200
|
+
class Q extends me {
|
|
201
201
|
/**
|
|
202
202
|
* Constructs a new extrude geometry.
|
|
203
203
|
*
|
|
@@ -205,82 +205,82 @@ class K extends me {
|
|
|
205
205
|
* @param {ExtrudeGeometry~Options} [options] - The extrude settings.
|
|
206
206
|
*/
|
|
207
207
|
constructor(e = new we([
|
|
208
|
-
new
|
|
209
|
-
new
|
|
210
|
-
new
|
|
211
|
-
new
|
|
208
|
+
new E(0.5, 0.5),
|
|
209
|
+
new E(-0.5, 0.5),
|
|
210
|
+
new E(-0.5, -0.5),
|
|
211
|
+
new E(0.5, -0.5)
|
|
212
212
|
]), t = {}) {
|
|
213
213
|
super(), this.type = "ExtrudeGeometry", this.parameters = {
|
|
214
214
|
shapes: e,
|
|
215
215
|
options: t
|
|
216
216
|
}, e = Array.isArray(e) ? e : [e];
|
|
217
|
-
const n = this, s = [],
|
|
218
|
-
for (let f = 0,
|
|
217
|
+
const n = this, s = [], r = [];
|
|
218
|
+
for (let f = 0, i = e.length; f < i; f++) {
|
|
219
219
|
const h = e[f];
|
|
220
220
|
a(h);
|
|
221
221
|
}
|
|
222
|
-
this.setAttribute("position", new xe(s, 3)), this.setAttribute("uv", new xe(
|
|
222
|
+
this.setAttribute("position", new xe(s, 3)), this.setAttribute("uv", new xe(r, 2)), this.computeVertexNormals();
|
|
223
223
|
function a(f) {
|
|
224
|
-
var Te,
|
|
225
|
-
const
|
|
224
|
+
var Te, Ge, _e;
|
|
225
|
+
const i = [], h = t.curveSegments !== void 0 ? t.curveSegments : 12, o = t.steps !== void 0 ? t.steps : 1, c = t.depth !== void 0 ? t.depth : 1;
|
|
226
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,
|
|
228
|
-
let
|
|
229
|
-
A && (
|
|
227
|
+
const A = t.extrudePath, P = t.UVGenerator !== void 0 ? t.UVGenerator : Ot, v = (Te = t.hasTop) != null ? Te : !0, C = (Ge = t.hasBottom) != null ? Ge : !0, ee = (_e = t.hasSide) != null ? _e : !0;
|
|
228
|
+
let X, Z = !1, R, se, oe, V;
|
|
229
|
+
A && (X = A.getSpacedPoints(o), Z = !0, g = !1, R = A.computeFrenetFrames(o, !1), se = new z(), oe = new z(), V = new z()), g || (S = 0, u = 0, y = 0, L = 0);
|
|
230
230
|
const ve = f.extractPoints(h);
|
|
231
|
-
let
|
|
232
|
-
const
|
|
233
|
-
if (!fe.isClockWise(
|
|
234
|
-
|
|
235
|
-
for (let l = 0, d =
|
|
236
|
-
const m =
|
|
237
|
-
fe.isClockWise(m) && (
|
|
231
|
+
let U = ve.shape;
|
|
232
|
+
const j = ve.holes;
|
|
233
|
+
if (!fe.isClockWise(U)) {
|
|
234
|
+
U = U.reverse();
|
|
235
|
+
for (let l = 0, d = j.length; l < d; l++) {
|
|
236
|
+
const m = j[l];
|
|
237
|
+
fe.isClockWise(m) && (j[l] = m.reverse());
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
240
|
function Se(l) {
|
|
241
241
|
const m = 10000000000000001e-36;
|
|
242
242
|
let x = l[0];
|
|
243
243
|
for (let b = 1; b <= l.length; b++) {
|
|
244
|
-
const M = b % l.length, w = l[M], T = w.x - x.x,
|
|
244
|
+
const M = b % l.length, w = l[M], T = w.x - x.x, G = w.y - x.y, _ = T * T + G * G, I = Math.max(
|
|
245
245
|
Math.abs(w.x),
|
|
246
246
|
Math.abs(w.y),
|
|
247
247
|
Math.abs(x.x),
|
|
248
248
|
Math.abs(x.y)
|
|
249
|
-
),
|
|
250
|
-
if (
|
|
249
|
+
), J = m * I * I;
|
|
250
|
+
if (_ <= J) {
|
|
251
251
|
l.splice(M, 1), b--;
|
|
252
252
|
continue;
|
|
253
253
|
}
|
|
254
254
|
x = w;
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
|
-
Se(
|
|
258
|
-
const pe =
|
|
257
|
+
Se(U), j.forEach(Se);
|
|
258
|
+
const pe = j.length, D = U;
|
|
259
259
|
for (let l = 0; l < pe; l++) {
|
|
260
|
-
const d =
|
|
261
|
-
|
|
260
|
+
const d = j[l];
|
|
261
|
+
U = U.concat(d);
|
|
262
262
|
}
|
|
263
263
|
function te(l, d, m) {
|
|
264
264
|
return d || error("ExtrudeGeometry: vec does not exist"), l.clone().addScaledVector(d, m);
|
|
265
265
|
}
|
|
266
|
-
const
|
|
266
|
+
const W = U.length;
|
|
267
267
|
function Ae(l, d, m) {
|
|
268
268
|
let x, b, M;
|
|
269
|
-
const w = l.x - d.x, T = l.y - d.y,
|
|
270
|
-
if (Math.abs(
|
|
271
|
-
const
|
|
272
|
-
|
|
273
|
-
),
|
|
274
|
-
x =
|
|
269
|
+
const w = l.x - d.x, T = l.y - d.y, G = m.x - l.x, _ = m.y - l.y, I = w * w + T * T, J = w * _ - T * G;
|
|
270
|
+
if (Math.abs(J) > Number.EPSILON) {
|
|
271
|
+
const B = Math.sqrt(I), Ee = Math.sqrt(
|
|
272
|
+
G * G + _ * _
|
|
273
|
+
), Pe = d.x - T / B, ze = d.y + w / B, Ze = m.x - _ / Ee, $e = m.y + G / Ee, Ce = ((Ze - Pe) * _ - ($e - ze) * G) / (w * _ - T * G);
|
|
274
|
+
x = Pe + w * Ce - l.x, b = ze + T * Ce - l.y;
|
|
275
275
|
const je = x * x + b * b;
|
|
276
276
|
if (je <= 2)
|
|
277
|
-
return new
|
|
277
|
+
return new E(x, b);
|
|
278
278
|
M = Math.sqrt(je / 2);
|
|
279
279
|
} else {
|
|
280
|
-
let
|
|
281
|
-
w > Number.EPSILON ?
|
|
280
|
+
let B = !1;
|
|
281
|
+
w > Number.EPSILON ? G > Number.EPSILON && (B = !0) : w < -Number.EPSILON ? G < -Number.EPSILON && (B = !0) : Math.sign(T) === Math.sign(_) && (B = !0), B ? (x = -T, b = w, M = Math.sqrt(I)) : (x = w, b = T, M = Math.sqrt(I / 2));
|
|
282
282
|
}
|
|
283
|
-
return new
|
|
283
|
+
return new E(x / M, b / M);
|
|
284
284
|
}
|
|
285
285
|
const re = [];
|
|
286
286
|
for (let l = 0, d = D.length, m = d - 1, x = l + 1; l < d; l++, m++, x++)
|
|
@@ -288,65 +288,65 @@ class K extends me {
|
|
|
288
288
|
const ge = [];
|
|
289
289
|
let q, ae = re.concat();
|
|
290
290
|
for (let l = 0, d = pe; l < d; l++) {
|
|
291
|
-
const m =
|
|
291
|
+
const m = j[l];
|
|
292
292
|
q = [];
|
|
293
293
|
for (let x = 0, b = m.length, M = b - 1, w = x + 1; x < b; x++, M++, w++)
|
|
294
294
|
M === b && (M = 0), w === b && (w = 0), q[x] = Ae(m[x], m[M], m[w]);
|
|
295
295
|
ge.push(q), ae = ae.concat(q);
|
|
296
296
|
}
|
|
297
|
-
let
|
|
297
|
+
let $;
|
|
298
298
|
if (S === 0)
|
|
299
|
-
|
|
299
|
+
$ = fe.triangulateShape(D, j);
|
|
300
300
|
else {
|
|
301
301
|
const l = [], d = [];
|
|
302
302
|
for (let m = 0; m < S; m++) {
|
|
303
303
|
const x = m / S, b = u * Math.cos(x * Math.PI / 2), M = y * Math.sin(x * Math.PI / 2) + L;
|
|
304
304
|
for (let w = 0, T = D.length; w < T; w++) {
|
|
305
|
-
const
|
|
306
|
-
|
|
305
|
+
const G = te(D[w], re[w], M);
|
|
306
|
+
N(G.x, G.y, -b), x === 0 && l.push(G);
|
|
307
307
|
}
|
|
308
308
|
for (let w = 0, T = pe; w < T; w++) {
|
|
309
|
-
const
|
|
309
|
+
const G = j[w];
|
|
310
310
|
q = ge[w];
|
|
311
|
-
const
|
|
312
|
-
for (let
|
|
313
|
-
const
|
|
314
|
-
|
|
311
|
+
const _ = [];
|
|
312
|
+
for (let I = 0, J = G.length; I < J; I++) {
|
|
313
|
+
const B = te(G[I], q[I], M);
|
|
314
|
+
N(B.x, B.y, -b), x === 0 && _.push(B);
|
|
315
315
|
}
|
|
316
|
-
x === 0 && d.push(
|
|
316
|
+
x === 0 && d.push(_);
|
|
317
317
|
}
|
|
318
318
|
}
|
|
319
|
-
|
|
319
|
+
$ = fe.triangulateShape(
|
|
320
320
|
l,
|
|
321
321
|
d
|
|
322
322
|
);
|
|
323
323
|
}
|
|
324
|
-
const ce =
|
|
325
|
-
for (let l = 0; l <
|
|
326
|
-
const d = g ? te(
|
|
327
|
-
|
|
324
|
+
const ce = $.length, Me = y + L;
|
|
325
|
+
for (let l = 0; l < W; l++) {
|
|
326
|
+
const d = g ? te(U[l], ae[l], Me) : U[l];
|
|
327
|
+
Z ? (oe.copy(R.normals[0]).multiplyScalar(d.x), se.copy(R.binormals[0]).multiplyScalar(d.y), V.copy(X[0]).add(oe).add(se), N(V.x, V.y, V.z)) : N(d.x, d.y, 0);
|
|
328
328
|
}
|
|
329
|
-
for (let l = 1; l <=
|
|
330
|
-
for (let d = 0; d <
|
|
331
|
-
const m = g ? te(
|
|
332
|
-
|
|
329
|
+
for (let l = 1; l <= o; l++)
|
|
330
|
+
for (let d = 0; d < W; d++) {
|
|
331
|
+
const m = g ? te(U[d], ae[d], Me) : U[d];
|
|
332
|
+
Z ? (oe.copy(R.normals[l]).multiplyScalar(m.x), se.copy(R.binormals[l]).multiplyScalar(m.y), V.copy(X[l]).add(oe).add(se), N(V.x, V.y, V.z)) : N(m.x, m.y, c / o * l);
|
|
333
333
|
}
|
|
334
334
|
for (let l = S - 1; l >= 0; l--) {
|
|
335
335
|
const d = l / S, m = u * Math.cos(d * Math.PI / 2), x = y * Math.sin(d * Math.PI / 2) + L;
|
|
336
336
|
for (let b = 0, M = D.length; b < M; b++) {
|
|
337
337
|
const w = te(D[b], re[b], x);
|
|
338
|
-
|
|
338
|
+
N(w.x, w.y, c + m);
|
|
339
339
|
}
|
|
340
|
-
for (let b = 0, M =
|
|
341
|
-
const w =
|
|
340
|
+
for (let b = 0, M = j.length; b < M; b++) {
|
|
341
|
+
const w = j[b];
|
|
342
342
|
q = ge[b];
|
|
343
|
-
for (let T = 0,
|
|
344
|
-
const
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
) :
|
|
343
|
+
for (let T = 0, G = w.length; T < G; T++) {
|
|
344
|
+
const _ = te(w[T], q[T], x);
|
|
345
|
+
Z ? N(
|
|
346
|
+
_.x,
|
|
347
|
+
_.y + X[o - 1].y,
|
|
348
|
+
X[o - 1].x + m
|
|
349
|
+
) : N(_.x, _.y, c + m);
|
|
350
350
|
}
|
|
351
351
|
}
|
|
352
352
|
}
|
|
@@ -354,30 +354,30 @@ class K extends me {
|
|
|
354
354
|
function Fe() {
|
|
355
355
|
const l = s.length / 3;
|
|
356
356
|
if (g) {
|
|
357
|
-
let d = 0, m =
|
|
358
|
-
if (
|
|
357
|
+
let d = 0, m = W * d;
|
|
358
|
+
if (C)
|
|
359
359
|
for (let x = 0; x < ce; x++) {
|
|
360
|
-
const b =
|
|
360
|
+
const b = $[x];
|
|
361
361
|
le(b[2] + m, b[1] + m, b[0] + m);
|
|
362
362
|
}
|
|
363
|
-
if (d =
|
|
363
|
+
if (d = o + S * 2, m = W * d, v)
|
|
364
364
|
for (let x = 0; x < ce; x++) {
|
|
365
|
-
const b =
|
|
365
|
+
const b = $[x];
|
|
366
366
|
le(b[0] + m, b[1] + m, b[2] + m);
|
|
367
367
|
}
|
|
368
368
|
} else {
|
|
369
|
-
if (
|
|
369
|
+
if (C)
|
|
370
370
|
for (let d = 0; d < ce; d++) {
|
|
371
|
-
const m =
|
|
371
|
+
const m = $[d];
|
|
372
372
|
le(m[2], m[1], m[0]);
|
|
373
373
|
}
|
|
374
374
|
if (v)
|
|
375
375
|
for (let d = 0; d < ce; d++) {
|
|
376
|
-
const m =
|
|
376
|
+
const m = $[d];
|
|
377
377
|
le(
|
|
378
|
-
m[0] +
|
|
379
|
-
m[1] +
|
|
380
|
-
m[2] +
|
|
378
|
+
m[0] + W * o,
|
|
379
|
+
m[1] + W * o,
|
|
380
|
+
m[2] + W * o
|
|
381
381
|
);
|
|
382
382
|
}
|
|
383
383
|
}
|
|
@@ -387,8 +387,8 @@ class K extends me {
|
|
|
387
387
|
const l = s.length / 3;
|
|
388
388
|
let d = 0;
|
|
389
389
|
Le(D, d), d += D.length;
|
|
390
|
-
for (let m = 0, x =
|
|
391
|
-
const b =
|
|
390
|
+
for (let m = 0, x = j.length; m < x; m++) {
|
|
391
|
+
const b = j[m];
|
|
392
392
|
Le(b, d), d += b.length;
|
|
393
393
|
}
|
|
394
394
|
n.addGroup(l, s.length / 3 - l, 1);
|
|
@@ -399,18 +399,18 @@ class K extends me {
|
|
|
399
399
|
const x = m;
|
|
400
400
|
let b = m - 1;
|
|
401
401
|
b < 0 && (b = l.length - 1);
|
|
402
|
-
for (let M = 0, w =
|
|
403
|
-
const T =
|
|
404
|
-
Ye(
|
|
402
|
+
for (let M = 0, w = o + S * 2; M < w; M++) {
|
|
403
|
+
const T = W * M, G = W * (M + 1), _ = d + x + T, I = d + b + T, J = d + b + G, B = d + x + G;
|
|
404
|
+
Ye(_, I, J, B);
|
|
405
405
|
}
|
|
406
406
|
}
|
|
407
407
|
}
|
|
408
|
-
function
|
|
409
|
-
|
|
408
|
+
function N(l, d, m) {
|
|
409
|
+
i.push(l), i.push(d), i.push(m);
|
|
410
410
|
}
|
|
411
411
|
function le(l, d, m) {
|
|
412
412
|
k(l), k(d), k(m);
|
|
413
|
-
const x = s.length / 3, b =
|
|
413
|
+
const x = s.length / 3, b = P.generateTopUV(
|
|
414
414
|
n,
|
|
415
415
|
s,
|
|
416
416
|
x - 3,
|
|
@@ -421,7 +421,7 @@ class K extends me {
|
|
|
421
421
|
}
|
|
422
422
|
function Ye(l, d, m, x) {
|
|
423
423
|
k(l), k(d), k(x), k(d), k(m), k(x);
|
|
424
|
-
const b = s.length / 3, M =
|
|
424
|
+
const b = s.length / 3, M = P.generateSideWallUV(
|
|
425
425
|
n,
|
|
426
426
|
s,
|
|
427
427
|
b - 6,
|
|
@@ -432,10 +432,10 @@ class K extends me {
|
|
|
432
432
|
F(M[0]), F(M[1]), F(M[3]), F(M[1]), F(M[2]), F(M[3]);
|
|
433
433
|
}
|
|
434
434
|
function k(l) {
|
|
435
|
-
s.push(
|
|
435
|
+
s.push(i[l * 3 + 0]), s.push(i[l * 3 + 1]), s.push(i[l * 3 + 2]);
|
|
436
436
|
}
|
|
437
437
|
function F(l) {
|
|
438
|
-
|
|
438
|
+
r.push(l.x), r.push(l.y);
|
|
439
439
|
}
|
|
440
440
|
}
|
|
441
441
|
}
|
|
@@ -444,7 +444,7 @@ class K extends me {
|
|
|
444
444
|
}
|
|
445
445
|
toJSON() {
|
|
446
446
|
const e = super.toJSON(), t = this.parameters.shapes, n = this.parameters.options;
|
|
447
|
-
return
|
|
447
|
+
return Ut(t, n, e);
|
|
448
448
|
}
|
|
449
449
|
/**
|
|
450
450
|
* Factory method for creating an instance of this class from the given
|
|
@@ -456,190 +456,190 @@ class K extends me {
|
|
|
456
456
|
*/
|
|
457
457
|
static fromJSON(e, t) {
|
|
458
458
|
const n = [];
|
|
459
|
-
for (let
|
|
460
|
-
const f = t[e.shapes[
|
|
459
|
+
for (let r = 0, a = e.shapes.length; r < a; r++) {
|
|
460
|
+
const f = t[e.shapes[r]];
|
|
461
461
|
n.push(f);
|
|
462
462
|
}
|
|
463
463
|
const s = e.options.extrudePath;
|
|
464
464
|
return s !== void 0 && (e.options.extrudePath = new Bt[s.type]().fromJSON(
|
|
465
465
|
s
|
|
466
|
-
)), new
|
|
466
|
+
)), new Q(n, e.options);
|
|
467
467
|
}
|
|
468
468
|
}
|
|
469
469
|
const Ot = {
|
|
470
470
|
generateTopUV: function(p, e, t, n, s) {
|
|
471
|
-
const
|
|
471
|
+
const r = e[t * 3], a = e[t * 3 + 1], f = e[n * 3], i = e[n * 3 + 1], h = e[s * 3], o = e[s * 3 + 1];
|
|
472
472
|
return [
|
|
473
|
-
new
|
|
474
|
-
new
|
|
475
|
-
new
|
|
473
|
+
new E(r, a),
|
|
474
|
+
new E(f, i),
|
|
475
|
+
new E(h, o)
|
|
476
476
|
];
|
|
477
477
|
},
|
|
478
|
-
generateSideWallUV: function(p, e, t, n, s,
|
|
479
|
-
const a = e[t * 3], f = e[t * 3 + 1],
|
|
480
|
-
return Math.abs(f -
|
|
481
|
-
new
|
|
482
|
-
new
|
|
483
|
-
new
|
|
484
|
-
new
|
|
478
|
+
generateSideWallUV: function(p, e, t, n, s, r) {
|
|
479
|
+
const a = e[t * 3], f = e[t * 3 + 1], i = e[t * 3 + 2], h = e[n * 3], o = 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[r * 3], S = e[r * 3 + 1], A = e[r * 3 + 2];
|
|
480
|
+
return Math.abs(f - o) < Math.abs(a - h) ? [
|
|
481
|
+
new E(a, 1 - i),
|
|
482
|
+
new E(h, 1 - c),
|
|
483
|
+
new E(g, 1 - y),
|
|
484
|
+
new E(L, 1 - A)
|
|
485
485
|
] : [
|
|
486
|
-
new
|
|
487
|
-
new
|
|
488
|
-
new
|
|
489
|
-
new
|
|
486
|
+
new E(f, 1 - i),
|
|
487
|
+
new E(o, 1 - c),
|
|
488
|
+
new E(u, 1 - y),
|
|
489
|
+
new E(S, 1 - A)
|
|
490
490
|
];
|
|
491
491
|
}
|
|
492
492
|
};
|
|
493
|
-
function
|
|
493
|
+
function Ut(p, e, t) {
|
|
494
494
|
if (t.shapes = [], Array.isArray(p))
|
|
495
495
|
for (let n = 0, s = p.length; n < s; n++) {
|
|
496
|
-
const
|
|
497
|
-
t.shapes.push(
|
|
496
|
+
const r = p[n];
|
|
497
|
+
t.shapes.push(r.uuid);
|
|
498
498
|
}
|
|
499
499
|
else
|
|
500
500
|
t.shapes.push(p.uuid);
|
|
501
501
|
return t.options = Object.assign({}, e), e.extrudePath !== void 0 && (t.options.extrudePath = e.extrudePath.toJSON()), t;
|
|
502
502
|
}
|
|
503
|
-
class
|
|
503
|
+
class Rt extends Q {
|
|
504
504
|
constructor(e, t) {
|
|
505
505
|
super(e, t);
|
|
506
|
-
const n = new
|
|
507
|
-
new
|
|
506
|
+
const n = new Re(
|
|
507
|
+
new Q(e, ue(O({}, t), {
|
|
508
508
|
hasTop: !0,
|
|
509
509
|
hasSide: !0,
|
|
510
510
|
hasBottom: !1
|
|
511
511
|
}))
|
|
512
512
|
);
|
|
513
513
|
n.updateMatrixWorld();
|
|
514
|
-
const s = new pt().setFromObject(n),
|
|
515
|
-
s.getSize(
|
|
516
|
-
const a = new
|
|
517
|
-
s.min.x +
|
|
518
|
-
s.min.y +
|
|
514
|
+
const s = new pt().setFromObject(n), r = new z();
|
|
515
|
+
s.getSize(r);
|
|
516
|
+
const a = new z(
|
|
517
|
+
s.min.x + r.x / 2,
|
|
518
|
+
s.min.y + r.y / 2,
|
|
519
519
|
0
|
|
520
520
|
);
|
|
521
|
-
let f = t.topSegments,
|
|
522
|
-
if (
|
|
523
|
-
|
|
524
|
-
const A = new
|
|
525
|
-
|
|
526
|
-
const
|
|
527
|
-
|
|
528
|
-
|
|
521
|
+
let f = t.topSegments, i = t.box3;
|
|
522
|
+
if (i) {
|
|
523
|
+
i = i.union(s);
|
|
524
|
+
const A = new z();
|
|
525
|
+
i.getSize(A);
|
|
526
|
+
const P = Math.max(
|
|
527
|
+
r.x / A.x,
|
|
528
|
+
r.y / A.y
|
|
529
529
|
);
|
|
530
|
-
f = Math.ceil(t.topSegments *
|
|
530
|
+
f = Math.ceil(t.topSegments * P);
|
|
531
531
|
}
|
|
532
532
|
if (f < 4)
|
|
533
533
|
return this;
|
|
534
534
|
const h = new gt(
|
|
535
|
-
|
|
536
|
-
|
|
535
|
+
r.x,
|
|
536
|
+
r.y,
|
|
537
537
|
f,
|
|
538
538
|
f
|
|
539
|
-
),
|
|
540
|
-
|
|
541
|
-
const g = new
|
|
539
|
+
), o = new Re(h);
|
|
540
|
+
o.position.set(a.x, a.y, a.z), o.updateMatrixWorld();
|
|
541
|
+
const g = new zt().evaluate(o, n, Ct), u = g.geometry.getAttribute("position"), y = new xe(
|
|
542
542
|
u.count * 2,
|
|
543
543
|
2
|
|
544
544
|
);
|
|
545
545
|
for (let A = 0; A < u.count; A++) {
|
|
546
|
-
const
|
|
547
|
-
u.setZ(A, t.depth +
|
|
546
|
+
const P = u.getZ(A);
|
|
547
|
+
u.setZ(A, t.depth + P);
|
|
548
548
|
}
|
|
549
|
-
if (
|
|
550
|
-
const A =
|
|
551
|
-
for (let
|
|
552
|
-
const ee = u.getX(
|
|
553
|
-
y.setXY(
|
|
549
|
+
if (i) {
|
|
550
|
+
const A = i.min, P = i.max, v = new z().subVectors(P, A);
|
|
551
|
+
for (let C = 0; C < u.count; C++) {
|
|
552
|
+
const ee = u.getX(C), X = u.getY(C), Z = (ee - A.x) / v.x, R = (X - A.y) / v.y;
|
|
553
|
+
y.setXY(C, Z, R);
|
|
554
554
|
}
|
|
555
555
|
g.geometry.setAttribute("uv", y);
|
|
556
556
|
}
|
|
557
557
|
u.needsUpdate = !0;
|
|
558
|
-
const L = new
|
|
558
|
+
const L = new Q(e, ue(O({}, t), {
|
|
559
559
|
hasTop: !1
|
|
560
|
-
})), S =
|
|
560
|
+
})), S = H([g.geometry, L], 2);
|
|
561
561
|
this.copy(S.toNonIndexed());
|
|
562
562
|
}
|
|
563
563
|
}
|
|
564
|
-
const
|
|
564
|
+
const He = (p) => {
|
|
565
565
|
const {
|
|
566
566
|
split: e,
|
|
567
567
|
depth: t,
|
|
568
568
|
points: n,
|
|
569
569
|
box3: s,
|
|
570
|
-
hasTop:
|
|
570
|
+
hasTop: r,
|
|
571
571
|
hasBottom: a,
|
|
572
572
|
hasSide: f,
|
|
573
|
-
sideRepeat:
|
|
573
|
+
sideRepeat: i,
|
|
574
574
|
topSegments: h
|
|
575
|
-
} = p,
|
|
575
|
+
} = p, o = h ? Rt : Q, c = new o(new we(n), {
|
|
576
576
|
depth: t,
|
|
577
577
|
bevelEnabled: !1,
|
|
578
578
|
box3: s,
|
|
579
|
-
UVGenerator:
|
|
579
|
+
UVGenerator: Et({
|
|
580
580
|
split: e,
|
|
581
581
|
box3: s,
|
|
582
|
-
sideRepeat:
|
|
582
|
+
sideRepeat: i
|
|
583
583
|
}),
|
|
584
|
-
hasTop:
|
|
584
|
+
hasTop: r,
|
|
585
585
|
hasBottom: a,
|
|
586
586
|
hasSide: f,
|
|
587
587
|
topSegments: h
|
|
588
588
|
});
|
|
589
|
-
return
|
|
589
|
+
return Pt(), c;
|
|
590
590
|
};
|
|
591
|
-
class Qt extends
|
|
591
|
+
class Qt extends K {
|
|
592
592
|
constructor(e) {
|
|
593
|
-
super(), this.options =
|
|
593
|
+
super(), this.options = O({
|
|
594
594
|
depth: 1
|
|
595
595
|
}, e);
|
|
596
596
|
}
|
|
597
597
|
create() {
|
|
598
|
-
return
|
|
598
|
+
return ie(this, null, function* () {
|
|
599
599
|
const {
|
|
600
600
|
points: e,
|
|
601
601
|
pointsArr: t,
|
|
602
602
|
useGroups: n,
|
|
603
603
|
depth: s,
|
|
604
|
-
geometry:
|
|
604
|
+
geometry: r,
|
|
605
605
|
geometryArr: a,
|
|
606
606
|
material: f,
|
|
607
|
-
box3:
|
|
607
|
+
box3: i,
|
|
608
608
|
split: h,
|
|
609
|
-
hasTop:
|
|
609
|
+
hasTop: o,
|
|
610
610
|
hasBottom: c,
|
|
611
611
|
hasSide: g
|
|
612
|
-
} = this.options, u = Array.isArray(s) ? s : [s], y = Array.isArray(
|
|
613
|
-
let S =
|
|
614
|
-
L || console.log("material is null"), !S && e ? S =
|
|
612
|
+
} = this.options, u = Array.isArray(s) ? s : [s], y = Array.isArray(i) ? i : [i], L = f;
|
|
613
|
+
let S = r;
|
|
614
|
+
L || console.log("material is null"), !S && e ? S = He({
|
|
615
615
|
points: e,
|
|
616
616
|
depth: u[0],
|
|
617
617
|
box3: y[0],
|
|
618
618
|
split: h,
|
|
619
|
-
hasTop:
|
|
619
|
+
hasTop: o,
|
|
620
620
|
hasBottom: c,
|
|
621
621
|
hasSide: g
|
|
622
|
-
}) : !S && t ? S =
|
|
622
|
+
}) : !S && t ? S = H(
|
|
623
623
|
t.map(
|
|
624
|
-
(A,
|
|
625
|
-
var v,
|
|
626
|
-
return
|
|
624
|
+
(A, P) => {
|
|
625
|
+
var v, C;
|
|
626
|
+
return He({
|
|
627
627
|
points: A,
|
|
628
|
-
depth: (v = u[
|
|
629
|
-
box3: (
|
|
628
|
+
depth: (v = u[P]) != null ? v : u[0],
|
|
629
|
+
box3: (C = y[P]) != null ? C : y[0],
|
|
630
630
|
split: h,
|
|
631
|
-
hasTop:
|
|
631
|
+
hasTop: o,
|
|
632
632
|
hasBottom: c,
|
|
633
633
|
hasSide: g
|
|
634
634
|
});
|
|
635
635
|
}
|
|
636
636
|
),
|
|
637
637
|
n != null ? n : 0
|
|
638
|
-
) : !S && a && a.length > 1 ? S =
|
|
638
|
+
) : !S && a && a.length > 1 ? S = H(a, n != null ? n : 0) : !S && a && a.length === 1 && ([S] = a), this.createMesh(S, L);
|
|
639
639
|
});
|
|
640
640
|
}
|
|
641
641
|
addGeometries(e) {
|
|
642
|
-
const t = this.object3d, n =
|
|
642
|
+
const t = this.object3d, n = H([t.geometry, ...e]);
|
|
643
643
|
t.geometry = n;
|
|
644
644
|
}
|
|
645
645
|
setTextureAnisotropic(e, t) {
|
|
@@ -652,38 +652,45 @@ const Kt = (p) => {
|
|
|
652
652
|
sideColor: t,
|
|
653
653
|
sideMap: n,
|
|
654
654
|
createCanvasObjectURL: s,
|
|
655
|
-
split:
|
|
655
|
+
split: r,
|
|
656
656
|
maxAnisotropy: a
|
|
657
657
|
} = p;
|
|
658
658
|
return new Promise((f) => {
|
|
659
|
-
const
|
|
659
|
+
const i = n ? document.createElement("img") : {
|
|
660
660
|
src: "",
|
|
661
661
|
onload: () => {
|
|
662
662
|
},
|
|
663
663
|
width: 128,
|
|
664
664
|
height: 128
|
|
665
665
|
};
|
|
666
|
-
|
|
667
|
-
const h =
|
|
668
|
-
|
|
666
|
+
i.onload = () => {
|
|
667
|
+
const h = r, o = document.createElement("canvas"), c = o.getContext("2d");
|
|
668
|
+
o.height = i.height / (1 - h), o.width = i.width, h && e && (c.fillStyle = e, c.fillRect(0, 0, i.width, o.height * h)), n && i instanceof HTMLImageElement ? c.drawImage(i, 0, o.height * h, i.width, i.height) : t && (c.fillStyle = t, c.fillRect(0, o.height * h, i.width, i.height)), s && o.toBlob((u) => {
|
|
669
669
|
console.log(URL.createObjectURL(u));
|
|
670
670
|
});
|
|
671
|
-
const g = new yt(
|
|
671
|
+
const g = new yt(o);
|
|
672
672
|
f(g);
|
|
673
|
-
}, n ?
|
|
673
|
+
}, n ? i.src = n : i instanceof HTMLImageElement || i.onload();
|
|
674
674
|
});
|
|
675
675
|
};
|
|
676
|
-
class en extends
|
|
676
|
+
class en extends K {
|
|
677
677
|
create() {
|
|
678
678
|
this.createGroup();
|
|
679
679
|
}
|
|
680
|
+
render() {
|
|
681
|
+
this.object3d.raycast = (e, t) => e.intersectObjects(
|
|
682
|
+
this.object3d.children,
|
|
683
|
+
!0,
|
|
684
|
+
t
|
|
685
|
+
);
|
|
686
|
+
}
|
|
680
687
|
}
|
|
681
|
-
class tn extends
|
|
688
|
+
class tn extends K {
|
|
682
689
|
constructor(e) {
|
|
683
690
|
super(), this.rectAreaLightUniformsLibInit = !1, this.options = e;
|
|
684
691
|
}
|
|
685
692
|
create() {
|
|
686
|
-
var t, n, s,
|
|
693
|
+
var t, n, s, r, a, f, i, h, o, c, g, u, y, L, S, A, P;
|
|
687
694
|
const e = this.options;
|
|
688
695
|
if (e.type === "AmbientLight") {
|
|
689
696
|
const v = new bt(e.color);
|
|
@@ -696,16 +703,16 @@ class tn extends Z {
|
|
|
696
703
|
(t = e.color) != null ? t : 16777215,
|
|
697
704
|
(n = e.intensity) != null ? n : 1,
|
|
698
705
|
(s = e.distance) != null ? s : 0,
|
|
699
|
-
(
|
|
706
|
+
(r = e.decay) != null ? r : 2
|
|
700
707
|
);
|
|
701
708
|
v.name = "点光源", this.object3d = v, this.pointLight = v;
|
|
702
709
|
} else if (e.type === "SpotLight") {
|
|
703
710
|
const v = new vt(
|
|
704
711
|
(a = e.color) != null ? a : 16777215,
|
|
705
712
|
(f = e.intensity) != null ? f : 1,
|
|
706
|
-
(
|
|
713
|
+
(i = e.distance) != null ? i : 0,
|
|
707
714
|
(h = e.angle) != null ? h : Math.PI / 3,
|
|
708
|
-
(
|
|
715
|
+
(o = e.penumbra) != null ? o : 1,
|
|
709
716
|
(c = e.decay) != null ? c : 2
|
|
710
717
|
);
|
|
711
718
|
v.name = "聚光灯", this.object3d = v, this.spotLight = v, v.target.name = "聚光灯目标";
|
|
@@ -722,7 +729,7 @@ class tn extends Z {
|
|
|
722
729
|
(L = e.color) != null ? L : 16777215,
|
|
723
730
|
(S = e.intensity) != null ? S : 1,
|
|
724
731
|
(A = e.width) != null ? A : 10,
|
|
725
|
-
(
|
|
732
|
+
(P = e.height) != null ? P : 10
|
|
726
733
|
);
|
|
727
734
|
v.name = "矩形区域光", this.object3d = v, this.rectAreaLight = v;
|
|
728
735
|
}
|
|
@@ -743,24 +750,24 @@ class tn extends Z {
|
|
|
743
750
|
}
|
|
744
751
|
class Dt extends me {
|
|
745
752
|
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
|
|
753
|
+
super(), this.type = "MeshLineGeometry", this.pointCount = 0, this._points = [], this.shape = "none", this.shapeFunction = (s) => 1, this.matrixWorld = new We(), this.shape = t, n && (this.shapeFunction = n), e.length > 0 && this.setPoints(e);
|
|
747
754
|
}
|
|
748
755
|
convertToVector3Array(e) {
|
|
749
756
|
if (typeof e[0] == "number") {
|
|
750
757
|
const t = [], n = e;
|
|
751
758
|
for (let s = 0; s < n.length; s += 3)
|
|
752
|
-
t.push(new
|
|
759
|
+
t.push(new z(n[s], n[s + 1], n[s + 2]));
|
|
753
760
|
return t;
|
|
754
761
|
} else
|
|
755
762
|
return e.map((t) => {
|
|
756
|
-
if (t instanceof
|
|
757
|
-
return new
|
|
758
|
-
if (t instanceof
|
|
763
|
+
if (t instanceof E)
|
|
764
|
+
return new z(t.x, t.y, 0);
|
|
765
|
+
if (t instanceof z)
|
|
759
766
|
return t;
|
|
760
767
|
if (Array.isArray(t) && t.length === 2)
|
|
761
|
-
return new
|
|
768
|
+
return new z(t[0], t[1], 0);
|
|
762
769
|
if (Array.isArray(t) && t.length === 3)
|
|
763
|
-
return new
|
|
770
|
+
return new z(t[0], t[1], t[2]);
|
|
764
771
|
}).filter(Boolean);
|
|
765
772
|
}
|
|
766
773
|
setMatrixWorld(e) {
|
|
@@ -779,35 +786,35 @@ class Dt extends me {
|
|
|
779
786
|
), n = new Y(new Float32Array(this.pointCount * 6), 3), s = new Y(
|
|
780
787
|
new Float32Array(this.pointCount * 2),
|
|
781
788
|
1
|
|
782
|
-
),
|
|
789
|
+
), r = 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), i = new Y(
|
|
783
790
|
new Uint16Array((this.pointCount - 1) * 6),
|
|
784
791
|
1
|
|
785
792
|
);
|
|
786
793
|
this.shape === "taper" && (this.shapeFunction = (h) => 1 * Math.pow(4 * h * (1 - h), 1));
|
|
787
|
-
for (let h = 0,
|
|
788
|
-
s.setX(
|
|
794
|
+
for (let h = 0, o = 0, c = 0; h < this.pointCount; h += 1, o += 2, c += 6) {
|
|
795
|
+
s.setX(o, h / this.pointCount), s.setX(o + 1, h / this.pointCount), r.setX(o, 1), r.setX(o + 1, -1);
|
|
789
796
|
const g = this.shape === "none" ? 1 : this.shapeFunction(h / (this.pointCount - 1));
|
|
790
|
-
a.setX(
|
|
797
|
+
a.setX(o, g), a.setX(o + 1, g);
|
|
791
798
|
const u = h / (this.pointCount - 1);
|
|
792
|
-
if (f.setXY(
|
|
799
|
+
if (f.setXY(o, u, 0), f.setXY(o + 1, u, 1), h < this.pointCount - 1) {
|
|
793
800
|
const y = h * 2;
|
|
794
|
-
|
|
801
|
+
i.setX(c + 0, y + 0), i.setX(c + 1, y + 1), i.setX(c + 2, y + 2), i.setX(c + 3, y + 2), i.setX(c + 4, y + 1), i.setX(c + 5, y + 3);
|
|
795
802
|
}
|
|
796
803
|
}
|
|
797
|
-
this.setAttribute("position", e), this.setAttribute("previous", t), this.setAttribute("next", n), this.setAttribute("counters", s), this.setAttribute("side",
|
|
804
|
+
this.setAttribute("position", e), this.setAttribute("previous", t), this.setAttribute("next", n), this.setAttribute("counters", s), this.setAttribute("side", r), this.setAttribute("width", a), this.setAttribute("uv", f), this.setIndex(i);
|
|
798
805
|
}
|
|
799
806
|
updateGeometry() {
|
|
800
807
|
if (!this._points[0]) return;
|
|
801
808
|
const e = this.getAttribute("position"), t = this.getAttribute("previous"), n = this.getAttribute("next");
|
|
802
|
-
let s = 0,
|
|
809
|
+
let s = 0, r = 0, a = 0;
|
|
803
810
|
const f = this._points[0];
|
|
804
|
-
t.setXYZ(
|
|
811
|
+
t.setXYZ(r, f.x, f.y, f.z), r += 1, t.setXYZ(r, f.x, f.y, f.z), r += 1;
|
|
805
812
|
for (let h = 0; h < this.pointCount; h++) {
|
|
806
|
-
const
|
|
807
|
-
e.setXYZ(s,
|
|
813
|
+
const o = this._points[h];
|
|
814
|
+
e.setXYZ(s, o.x, o.y, o.z), s += 1, e.setXYZ(s, o.x, o.y, o.z), s += 1, h < this.pointCount - 1 && (t.setXYZ(r, o.x, o.y, o.z), r += 1, t.setXYZ(r, o.x, o.y, o.z), r += 1), h > 0 && h + 1 <= this.pointCount && (n.setXYZ(a, o.x, o.y, o.z), a += 1, n.setXYZ(a, o.x, o.y, o.z), a += 1);
|
|
808
815
|
}
|
|
809
|
-
const
|
|
810
|
-
n.setXYZ(a,
|
|
816
|
+
const i = this._points[this.pointCount - 1];
|
|
817
|
+
n.setXYZ(a, i.x, i.y, i.z), a += 1, n.setXYZ(a, i.x, i.y, i.z), a += 1, e.needsUpdate = !0, t.needsUpdate = !0, n.needsUpdate = !0, this.computeBoundingSphere(), this.computeBoundingBox();
|
|
811
818
|
}
|
|
812
819
|
get points() {
|
|
813
820
|
return this._points;
|
|
@@ -830,26 +837,26 @@ class Dt extends me {
|
|
|
830
837
|
}
|
|
831
838
|
}
|
|
832
839
|
function nn(p, e) {
|
|
833
|
-
const t = new
|
|
834
|
-
if (s.copy(a.boundingSphere), s.applyMatrix4(this.matrixWorld), !p.ray.intersectSphere(s,
|
|
840
|
+
const t = new We(), n = new Mt(), s = new Lt(), r = new z(), a = this.geometry;
|
|
841
|
+
if (s.copy(a.boundingSphere), s.applyMatrix4(this.matrixWorld), !p.ray.intersectSphere(s, r)) return;
|
|
835
842
|
t.copy(this.matrixWorld).invert(), n.copy(p.ray).applyMatrix4(t);
|
|
836
|
-
const f = new
|
|
843
|
+
const f = new z(), i = new z(), h = new z(), o = this instanceof Ne ? 2 : 1, c = a.index, g = a.attributes;
|
|
837
844
|
if (c !== null) {
|
|
838
845
|
const u = c.array, y = g.position.array, L = g.width.array;
|
|
839
|
-
for (let S = 0, A = u.length - 1; S < A; S +=
|
|
840
|
-
const
|
|
841
|
-
f.fromArray(y,
|
|
842
|
-
const
|
|
846
|
+
for (let S = 0, A = u.length - 1; S < A; S += o) {
|
|
847
|
+
const P = u[S], v = u[S + 1];
|
|
848
|
+
f.fromArray(y, P * 3), i.fromArray(y, v * 3);
|
|
849
|
+
const C = L[Math.floor(S / 3)] !== void 0 ? L[Math.floor(S / 3)] : 1, ee = p.params.Line.threshold + this.material.lineWidth * C / 2, X = ee * ee;
|
|
843
850
|
if (n.distanceSqToSegment(
|
|
844
851
|
f,
|
|
852
|
+
i,
|
|
845
853
|
r,
|
|
846
|
-
o,
|
|
847
854
|
h
|
|
848
|
-
) >
|
|
849
|
-
|
|
850
|
-
const
|
|
851
|
-
|
|
852
|
-
distance:
|
|
855
|
+
) > X) continue;
|
|
856
|
+
r.applyMatrix4(this.matrixWorld);
|
|
857
|
+
const R = p.ray.origin.distanceTo(r);
|
|
858
|
+
R < p.near || R > p.far || (e.push({
|
|
859
|
+
distance: R,
|
|
853
860
|
// What do we want? intersection point on the ray or on the segment??
|
|
854
861
|
// point: raycaster.ray.at( distance ),
|
|
855
862
|
point: h.clone().applyMatrix4(this.matrixWorld),
|
|
@@ -864,62 +871,62 @@ function nn(p, e) {
|
|
|
864
871
|
const be = (p) => {
|
|
865
872
|
const { setPointWidth: e, nodes: t } = p, n = new Dt();
|
|
866
873
|
return n.setPoints(t, e), n;
|
|
867
|
-
},
|
|
868
|
-
let sn = class extends
|
|
874
|
+
}, Xe = /* @__PURE__ */ new WeakMap(), de = /* @__PURE__ */ new Map();
|
|
875
|
+
let sn = class extends K {
|
|
869
876
|
constructor(e = {}) {
|
|
870
|
-
super(), this.options =
|
|
877
|
+
super(), this.options = O({}, e);
|
|
871
878
|
}
|
|
872
879
|
get material() {
|
|
873
880
|
var e;
|
|
874
881
|
return (e = this.object3d) == null ? void 0 : e.material;
|
|
875
882
|
}
|
|
876
883
|
create() {
|
|
877
|
-
return
|
|
884
|
+
return ie(this, null, function* () {
|
|
878
885
|
const {
|
|
879
886
|
nodes: e,
|
|
880
887
|
nodesArr: t,
|
|
881
888
|
geometry: n,
|
|
882
889
|
geometryArr: s,
|
|
883
|
-
material:
|
|
890
|
+
material: r,
|
|
884
891
|
useGroups: a,
|
|
885
892
|
setPointWidth: f,
|
|
886
|
-
lineWidthArr:
|
|
893
|
+
lineWidthArr: i,
|
|
887
894
|
materialParameters: h
|
|
888
895
|
} = this.options;
|
|
889
|
-
let
|
|
890
|
-
!
|
|
896
|
+
let o = r, c = n;
|
|
897
|
+
!o && h && (o = this.getMaterial(h)), !c && e ? c = be({
|
|
891
898
|
nodes: e,
|
|
892
899
|
setPointWidth: f
|
|
893
|
-
}) : !c && t ? c =
|
|
900
|
+
}) : !c && t ? c = H(
|
|
894
901
|
t.map((g, u) => {
|
|
895
902
|
let y = f;
|
|
896
|
-
return !y &&
|
|
903
|
+
return !y && i && (y = () => {
|
|
897
904
|
var L;
|
|
898
|
-
return (L =
|
|
905
|
+
return (L = i[u]) != null ? L : i[0];
|
|
899
906
|
}), be({
|
|
900
907
|
nodes: g,
|
|
901
908
|
setPointWidth: y
|
|
902
909
|
});
|
|
903
910
|
}),
|
|
904
911
|
a != null ? a : 0
|
|
905
|
-
) : !c && s && s.length > 1 ? c =
|
|
912
|
+
) : !c && s && s.length > 1 ? c = H(s, a != null ? a : 0) : !c && s && s.length === 1 && ([c] = s), this.createMesh(c, o);
|
|
906
913
|
});
|
|
907
914
|
}
|
|
908
915
|
setGeometry(e, t) {
|
|
909
916
|
const n = be({
|
|
910
917
|
nodes: e,
|
|
911
918
|
setPointWidth: t
|
|
912
|
-
}), s = this.object3d,
|
|
913
|
-
s.geometry = n,
|
|
919
|
+
}), s = this.object3d, r = s.geometry;
|
|
920
|
+
s.geometry = n, r.dispose();
|
|
914
921
|
}
|
|
915
922
|
getMaterial(e) {
|
|
916
|
-
const { width: t, height: n } = this.pencil.getSize(), s = new st(
|
|
923
|
+
const { width: t, height: n } = this.pencil.getSize(), s = new st(O({
|
|
917
924
|
color: new ke("#ffffff")
|
|
918
925
|
}, e));
|
|
919
926
|
return s.uniforms.resolution.value.set(t, n), s;
|
|
920
927
|
}
|
|
921
928
|
addGeometries(e) {
|
|
922
|
-
const t = this.object3d, n =
|
|
929
|
+
const t = this.object3d, n = H([t.geometry, ...e]);
|
|
923
930
|
t.geometry = n;
|
|
924
931
|
}
|
|
925
932
|
resize(e, t) {
|
|
@@ -937,20 +944,20 @@ let sn = class extends Z {
|
|
|
937
944
|
delay: t = 0,
|
|
938
945
|
repeat: n = 0,
|
|
939
946
|
lineLoop: s,
|
|
940
|
-
onRepeat:
|
|
947
|
+
onRepeat: r,
|
|
941
948
|
onUpdate: a,
|
|
942
949
|
onComplete: f,
|
|
943
|
-
startShow:
|
|
950
|
+
startShow: i
|
|
944
951
|
} = {}) {
|
|
945
|
-
const { offset: h, offsetLoop:
|
|
952
|
+
const { offset: h, offsetLoop: o } = this.material.uniforms, c = this.pencil.userData.debugLine ? de : Xe;
|
|
946
953
|
if (c.get(this.material) && this.stopAnimation(), e === 0) return;
|
|
947
954
|
const g = s != null ? s : !0;
|
|
948
|
-
h.value.x = 1,
|
|
955
|
+
h.value.x = 1, o.value = g && i ? 1 : 0;
|
|
949
956
|
let u = 0;
|
|
950
957
|
const y = new ne.Tween(h.value).to({ x: -1 }, e).delay(t).repeat(n).onUpdate(({ x: L }) => {
|
|
951
|
-
g && L <= 0 &&
|
|
958
|
+
g && L <= 0 && o.value === 0 && (o.value = 1), a == null || a(L);
|
|
952
959
|
}).onRepeat(() => {
|
|
953
|
-
u += 1,
|
|
960
|
+
u += 1, r == null || r(u);
|
|
954
961
|
}).onComplete(() => {
|
|
955
962
|
f == null || f();
|
|
956
963
|
}).start();
|
|
@@ -959,7 +966,7 @@ let sn = class extends Z {
|
|
|
959
966
|
}), this.pencil.userData.debugLine && console.log("animate", de.size);
|
|
960
967
|
}
|
|
961
968
|
stopAnimation() {
|
|
962
|
-
const e = this.pencil.userData.debugLine ? de :
|
|
969
|
+
const e = this.pencil.userData.debugLine ? de : Xe, t = e.get(this.material);
|
|
963
970
|
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);
|
|
964
971
|
}
|
|
965
972
|
render() {
|
|
@@ -967,47 +974,47 @@ let sn = class extends Z {
|
|
|
967
974
|
this.resize(e, t);
|
|
968
975
|
}
|
|
969
976
|
};
|
|
970
|
-
const
|
|
971
|
-
const { points: e } = p, t = e.reduce((s,
|
|
977
|
+
const Ve = (p) => {
|
|
978
|
+
const { points: e } = p, t = e.reduce((s, r, a) => (a < e.length - 1 && s.push(r, e[a + 1]), s), []);
|
|
972
979
|
return new me().setFromPoints(t);
|
|
973
980
|
};
|
|
974
|
-
class rn extends
|
|
981
|
+
class rn extends K {
|
|
975
982
|
constructor(e = {}) {
|
|
976
|
-
super(), this.options =
|
|
983
|
+
super(), this.options = O({}, e);
|
|
977
984
|
}
|
|
978
985
|
get material() {
|
|
979
986
|
var e;
|
|
980
987
|
return (e = this.object3d) == null ? void 0 : e.material;
|
|
981
988
|
}
|
|
982
989
|
create() {
|
|
983
|
-
return
|
|
990
|
+
return ie(this, null, function* () {
|
|
984
991
|
const {
|
|
985
992
|
points: e,
|
|
986
993
|
pointsArr: t,
|
|
987
994
|
geometry: n,
|
|
988
995
|
geometryArr: s,
|
|
989
|
-
material:
|
|
996
|
+
material: r,
|
|
990
997
|
useGroups: a,
|
|
991
998
|
setPointWidth: f,
|
|
992
|
-
lineWidthArr:
|
|
999
|
+
lineWidthArr: i,
|
|
993
1000
|
materialParameters: h,
|
|
994
|
-
instanceCount:
|
|
1001
|
+
instanceCount: o
|
|
995
1002
|
} = this.options;
|
|
996
|
-
let c =
|
|
997
|
-
!c && h && (c = this.getMaterial(h)), !g && e ? g =
|
|
1003
|
+
let c = r, g = n;
|
|
1004
|
+
!c && h && (c = this.getMaterial(h)), !g && e ? g = Ve({
|
|
998
1005
|
points: e
|
|
999
|
-
}) : !g && t ? g =
|
|
1000
|
-
t.map((y) =>
|
|
1006
|
+
}) : !g && t ? g = H(
|
|
1007
|
+
t.map((y) => Ve({
|
|
1001
1008
|
points: y
|
|
1002
1009
|
})),
|
|
1003
1010
|
a != null ? a : 0
|
|
1004
|
-
) : !g && s && s.length > 1 ? g =
|
|
1011
|
+
) : !g && s && s.length > 1 ? g = H(s, a != null ? a : 0) : !g && s && s.length === 1 && ([g] = s);
|
|
1005
1012
|
const u = new tt().fromLineSegments(
|
|
1006
|
-
new
|
|
1013
|
+
new Ne(g)
|
|
1007
1014
|
);
|
|
1008
1015
|
if (this.pencil.options.WebGPUTHREE) {
|
|
1009
|
-
|
|
1010
|
-
const y = new
|
|
1016
|
+
o && (u.instanceCount = o);
|
|
1017
|
+
const y = new ot(u, c);
|
|
1011
1018
|
y.computeLineDistances(), this.object3d = y;
|
|
1012
1019
|
} else {
|
|
1013
1020
|
const y = new It(u, c);
|
|
@@ -1016,61 +1023,14 @@ class rn extends Z {
|
|
|
1016
1023
|
});
|
|
1017
1024
|
}
|
|
1018
1025
|
getMaterial(e) {
|
|
1019
|
-
return new et(
|
|
1026
|
+
return new et(O({
|
|
1020
1027
|
color: new ke("#ffffff")
|
|
1021
1028
|
}, e));
|
|
1022
1029
|
}
|
|
1023
1030
|
}
|
|
1024
|
-
class an extends
|
|
1025
|
-
constructor(e) {
|
|
1026
|
-
super(), this.objectType = "Node", this.onNodePointerIndex = [], this.options = z({
|
|
1027
|
-
type: "2d"
|
|
1028
|
-
}, e);
|
|
1029
|
-
}
|
|
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());
|
|
1057
|
-
});
|
|
1058
|
-
});
|
|
1059
|
-
t.observe(e);
|
|
1060
|
-
}
|
|
1061
|
-
onPointerEvent(e, t) {
|
|
1062
|
-
const n = this.lead.handlePickNode([this], e, t);
|
|
1063
|
-
this.onNodePointerIndex.push(n);
|
|
1064
|
-
}
|
|
1065
|
-
dispose() {
|
|
1066
|
-
this.onNodePointerIndex.forEach((e) => {
|
|
1067
|
-
this.lead.removePickNode(e);
|
|
1068
|
-
}), super.dispose();
|
|
1069
|
-
}
|
|
1070
|
-
}
|
|
1071
|
-
class cn extends Z {
|
|
1031
|
+
class an extends K {
|
|
1072
1032
|
constructor(e) {
|
|
1073
|
-
super(), this.options =
|
|
1033
|
+
super(), this.options = O({
|
|
1074
1034
|
maxDepth: 10,
|
|
1075
1035
|
percentDepth: !1,
|
|
1076
1036
|
innerRadius: 25,
|
|
@@ -1079,31 +1039,31 @@ class cn extends Z {
|
|
|
1079
1039
|
}, e);
|
|
1080
1040
|
}
|
|
1081
1041
|
create() {
|
|
1082
|
-
return
|
|
1042
|
+
return ie(this, null, function* () {
|
|
1083
1043
|
this.createGroup();
|
|
1084
|
-
const { data: e, maxDepth: t, colors: n, material: s, percentDepth:
|
|
1044
|
+
const { data: e, maxDepth: t, colors: n, material: s, percentDepth: r, activeIndex: a } = this.options, f = Math.max(...e), i = e.reduce((o, c) => o + c, 0);
|
|
1085
1045
|
let h = Math.PI / 2;
|
|
1086
|
-
e.forEach((
|
|
1087
|
-
if (
|
|
1088
|
-
const g = Math.PI * 2 * (
|
|
1046
|
+
e.forEach((o, c) => {
|
|
1047
|
+
if (o === 0) return;
|
|
1048
|
+
const g = Math.PI * 2 * (o / i), u = n[c], y = r ? t * (o / f) : t, L = this.createGeometry(y, g), S = s ? s.clone() : new Tt({
|
|
1089
1049
|
color: u
|
|
1090
1050
|
});
|
|
1091
1051
|
s && S.color.set(u);
|
|
1092
|
-
const A = new
|
|
1052
|
+
const A = new Gt(L, S);
|
|
1093
1053
|
A.userData.depth = y, A.userData.index = c, A.rotateZ(h), h += g, this.add(A);
|
|
1094
1054
|
}), a !== -1 && this.setActive(a);
|
|
1095
1055
|
});
|
|
1096
1056
|
}
|
|
1097
1057
|
createGeometry(e, t) {
|
|
1098
|
-
const { outRadius: n, innerRadius: s } = this.options,
|
|
1099
|
-
return
|
|
1058
|
+
const { outRadius: n, innerRadius: s } = this.options, r = new we();
|
|
1059
|
+
return r.moveTo(n, 0), r.lineTo(s, 0), r.absarc(0, 0, s, 0, t, !1), r.absarc(0, 0, n, t, 0, !0), new Q(r, {
|
|
1100
1060
|
curveSegments: 48,
|
|
1101
1061
|
depth: e,
|
|
1102
1062
|
bevelEnabled: !1
|
|
1103
1063
|
});
|
|
1104
1064
|
}
|
|
1105
1065
|
handlePick(e, t = 1.3) {
|
|
1106
|
-
const { object: n } = this.pencil.pick(e, this.object3d.children) || {}, s = n ? this.object3d.children.findIndex((
|
|
1066
|
+
const { object: n } = this.pencil.pick(e, this.object3d.children) || {}, s = n ? this.object3d.children.findIndex((r) => r === n) : this.options.activeIndex;
|
|
1107
1067
|
return this.setActive(s, t);
|
|
1108
1068
|
}
|
|
1109
1069
|
setActive(e, t = 1.3) {
|
|
@@ -1112,8 +1072,8 @@ class cn extends Z {
|
|
|
1112
1072
|
if (!(n && n === s) && s.scale.z !== 1) {
|
|
1113
1073
|
if (s.userData.levTween) return;
|
|
1114
1074
|
s.userData.enTween && (s.userData.enTween.stop(), s.userData.enTween = null);
|
|
1115
|
-
const
|
|
1116
|
-
s.userData.levTween =
|
|
1075
|
+
const r = new ne.Tween(s.scale).to({ z: 1 }, 100);
|
|
1076
|
+
s.userData.levTween = r, r.start();
|
|
1117
1077
|
}
|
|
1118
1078
|
}), n) {
|
|
1119
1079
|
if (n.userData.enTween)
|
|
@@ -1135,13 +1095,13 @@ export {
|
|
|
1135
1095
|
tn as Light,
|
|
1136
1096
|
sn as Line,
|
|
1137
1097
|
rn as Line2,
|
|
1138
|
-
|
|
1139
|
-
|
|
1098
|
+
hn as Line2Material,
|
|
1099
|
+
fn as LineSegmentsGeometry,
|
|
1140
1100
|
Dt as MeshLineGeometry,
|
|
1141
1101
|
st as MeshLineMaterial,
|
|
1142
1102
|
nn as MeshLineRaycast,
|
|
1143
|
-
|
|
1144
|
-
|
|
1103
|
+
mn as Node,
|
|
1104
|
+
an as Pie,
|
|
1145
1105
|
nt as getConicPolygonGeometry,
|
|
1146
1106
|
pn as getConicPolygonGeometryMetas,
|
|
1147
1107
|
Kt as getSplitTexture
|