@souldi/try-on 0.4.3 → 0.4.4
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/README.md +20 -3
- package/dist/fonts/manrope-OFL.txt +93 -0
- package/dist/fonts/manrope-cyrillic-ext.woff2 +0 -0
- package/dist/fonts/manrope-cyrillic.woff2 +0 -0
- package/dist/fonts/manrope-greek.woff2 +0 -0
- package/dist/fonts/manrope-latin-ext.woff2 +0 -0
- package/dist/fonts/manrope-latin.woff2 +0 -0
- package/dist/fonts/manrope-vietnamese.woff2 +0 -0
- package/dist/fonts/newsreader-OFL.txt +93 -0
- package/dist/fonts/newsreader-italic-latin-ext.woff2 +0 -0
- package/dist/fonts/newsreader-italic-latin.woff2 +0 -0
- package/dist/fonts/newsreader-italic-vietnamese.woff2 +0 -0
- package/dist/fonts/newsreader-latin-ext.woff2 +0 -0
- package/dist/fonts/newsreader-latin.woff2 +0 -0
- package/dist/fonts/newsreader-vietnamese.woff2 +0 -0
- package/dist/mannequin-loader.mjs +169 -114
- package/dist/widget.mjs +1 -1
- package/dist/widget.umd.js +1 -1
- package/package.json +1 -1
|
@@ -10,33 +10,88 @@ var e = Object.freeze([
|
|
|
10
10
|
]), t = Object.freeze(["height", ...e]), n = Object.freeze(/* @__PURE__ */ new Set(["torso_length"]));
|
|
11
11
|
Object.freeze(Object.fromEntries(t.filter((e) => !n.has(e)).map((e) => [`declared_${e}_cm`, e])));
|
|
12
12
|
//#endregion
|
|
13
|
+
//#region src/fonts.mjs
|
|
14
|
+
var r = "Souldi Manrope", i = "Souldi Newsreader", a = {
|
|
15
|
+
"cyrillic-ext": "U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F",
|
|
16
|
+
cyrillic: "U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116",
|
|
17
|
+
greek: "U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF",
|
|
18
|
+
vietnamese: "U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB",
|
|
19
|
+
"latin-ext": "U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF",
|
|
20
|
+
latin: "U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD"
|
|
21
|
+
};
|
|
22
|
+
function o({ family: e, style: t, weight: n, stem: r, subsets: i }) {
|
|
23
|
+
return i.map((i) => ({
|
|
24
|
+
family: e,
|
|
25
|
+
style: t,
|
|
26
|
+
weight: n,
|
|
27
|
+
display: "swap",
|
|
28
|
+
file: `${r}-${i}.woff2`,
|
|
29
|
+
unicodeRange: a[i]
|
|
30
|
+
}));
|
|
31
|
+
}
|
|
32
|
+
var s = [
|
|
33
|
+
"cyrillic-ext",
|
|
34
|
+
"cyrillic",
|
|
35
|
+
"greek",
|
|
36
|
+
"vietnamese",
|
|
37
|
+
"latin-ext",
|
|
38
|
+
"latin"
|
|
39
|
+
], c = [
|
|
40
|
+
"vietnamese",
|
|
41
|
+
"latin-ext",
|
|
42
|
+
"latin"
|
|
43
|
+
];
|
|
44
|
+
Object.freeze([
|
|
45
|
+
...o({
|
|
46
|
+
family: r,
|
|
47
|
+
style: "normal",
|
|
48
|
+
weight: "300 800",
|
|
49
|
+
stem: "manrope",
|
|
50
|
+
subsets: s
|
|
51
|
+
}),
|
|
52
|
+
...o({
|
|
53
|
+
family: i,
|
|
54
|
+
style: "normal",
|
|
55
|
+
weight: "300 600",
|
|
56
|
+
stem: "newsreader",
|
|
57
|
+
subsets: c
|
|
58
|
+
}),
|
|
59
|
+
...o({
|
|
60
|
+
family: i,
|
|
61
|
+
style: "italic",
|
|
62
|
+
weight: "300 600",
|
|
63
|
+
stem: "newsreader-italic",
|
|
64
|
+
subsets: c
|
|
65
|
+
})
|
|
66
|
+
]);
|
|
67
|
+
//#endregion
|
|
13
68
|
//#region src/mannequin3d.js
|
|
14
|
-
async function
|
|
15
|
-
let [
|
|
69
|
+
async function l(t, n, i = []) {
|
|
70
|
+
let [a, { GLTFLoader: o }] = await Promise.all([import("./mannequin-chunks/three.module-BTc07Glh.mjs"), import("./mannequin-chunks/GLTFLoader-D8TDDHUI.mjs")]), s = !1, c = new a.Scene(), l = t.clientWidth || 300, u = t.clientHeight || 260, d = new a.WebGLRenderer({
|
|
16
71
|
antialias: !0,
|
|
17
72
|
alpha: !0
|
|
18
73
|
});
|
|
19
|
-
|
|
20
|
-
let
|
|
21
|
-
|
|
22
|
-
let
|
|
23
|
-
|
|
24
|
-
let
|
|
74
|
+
d.setPixelRatio(Math.min(2, window.devicePixelRatio || 1)), d.setSize(l, u), d.outputColorSpace = a.SRGBColorSpace, d.domElement.style.cssText = "position:absolute;inset:0;z-index:1;", t.appendChild(d.domElement), c.add(new a.HemisphereLight(16777215, 12170412, 1.5));
|
|
75
|
+
let f = new a.DirectionalLight(16777215, 1.6);
|
|
76
|
+
f.position.set(2, 4, 5), c.add(f);
|
|
77
|
+
let p = new a.DirectionalLight(16777215, .7);
|
|
78
|
+
p.position.set(-3, 2, -4), c.add(p);
|
|
79
|
+
let m = new a.MeshStandardMaterial({
|
|
25
80
|
color: 16053489,
|
|
26
81
|
roughness: .45,
|
|
27
82
|
metalness: 0
|
|
28
|
-
}),
|
|
29
|
-
if (
|
|
30
|
-
let
|
|
31
|
-
|
|
32
|
-
e.isMesh && (e.material =
|
|
33
|
-
}),
|
|
34
|
-
let
|
|
35
|
-
|
|
36
|
-
let b = new
|
|
37
|
-
|
|
38
|
-
let x = .01, S = [], C = new
|
|
39
|
-
|
|
83
|
+
}), h = [m], g = [], _ = await new Promise((e, t) => new o().load(n, e, void 0, t));
|
|
84
|
+
if (s) return { destroy() {} };
|
|
85
|
+
let v = _.scene;
|
|
86
|
+
v.traverse((e) => {
|
|
87
|
+
e.isMesh && (e.material = m, h.push(e.geometry));
|
|
88
|
+
}), c.add(v);
|
|
89
|
+
let y = new a.Box3().setFromObject(v), ee = 1.68 / (y.max.y - y.min.y || 1);
|
|
90
|
+
v.scale.setScalar(ee), v.updateMatrixWorld(!0);
|
|
91
|
+
let b = new a.Box3().setFromObject(v);
|
|
92
|
+
v.position.y -= b.min.y + .7, v.position.x -= (b.min.x + b.max.x) / 2, v.position.z -= (b.min.z + b.max.z) / 2, v.updateMatrixWorld(!0);
|
|
93
|
+
let x = .01, S = [], C = new a.Vector3();
|
|
94
|
+
v.traverse((e) => {
|
|
40
95
|
if (!e.isMesh) return;
|
|
41
96
|
let t = e.geometry.getAttribute("position"), n = Math.max(1, Math.floor(t.count / 8e4));
|
|
42
97
|
for (let r = 0; r < t.count; r += n) C.fromBufferAttribute(t, r), e.localToWorld(C), S.push(C.x, C.y, C.z);
|
|
@@ -61,73 +116,73 @@ async function r(t, n, r = []) {
|
|
|
61
116
|
}, D = (e) => {
|
|
62
117
|
let t = E(e, -.5, .5, .008);
|
|
63
118
|
return t ? t.w : 0;
|
|
64
|
-
},
|
|
65
|
-
for (let e = w - .12; e > w - .45; e -= .01) if (D(e) >
|
|
119
|
+
}, te = Math.max(.08, D(w - .1)), O = w - .28;
|
|
120
|
+
for (let e = w - .12; e > w - .45; e -= .01) if (D(e) > te * 1.9) {
|
|
66
121
|
O = e - .015;
|
|
67
122
|
break;
|
|
68
123
|
}
|
|
69
|
-
let
|
|
124
|
+
let ne = O - .13, k = E(ne, -.19, .19), A = {
|
|
70
125
|
shY: O,
|
|
71
126
|
shHalf: D(O) / 2,
|
|
72
|
-
chestY:
|
|
73
|
-
rx:
|
|
74
|
-
zc:
|
|
75
|
-
zF:
|
|
76
|
-
},
|
|
77
|
-
for (let e =
|
|
127
|
+
chestY: ne,
|
|
128
|
+
rx: k ? k.w / 2 : .14,
|
|
129
|
+
zc: k ? k.cz : 0,
|
|
130
|
+
zF: k ? k.z1 : .1
|
|
131
|
+
}, j = null, M = null;
|
|
132
|
+
for (let e = A.shY - .28; e > A.shY - .44; e -= .015) {
|
|
78
133
|
let t = E(e, -.19, .19);
|
|
79
|
-
t && (!
|
|
134
|
+
t && (!j || t.w < j.t.w) && (j = {
|
|
80
135
|
y: e,
|
|
81
136
|
t
|
|
82
137
|
});
|
|
83
138
|
}
|
|
84
|
-
for (let e =
|
|
139
|
+
for (let e = A.shY - .42; e > A.shY - .54; e -= .02) {
|
|
85
140
|
let t = E(e, -.165, .165);
|
|
86
|
-
t && (!
|
|
141
|
+
t && (!M || t.w > M.t.w) && (M = {
|
|
87
142
|
y: e,
|
|
88
143
|
t
|
|
89
144
|
});
|
|
90
145
|
}
|
|
91
|
-
|
|
92
|
-
let
|
|
93
|
-
|
|
94
|
-
let
|
|
95
|
-
|
|
96
|
-
let
|
|
97
|
-
let
|
|
98
|
-
color: r ||
|
|
146
|
+
A.waistRow = j, A.hipsRow = M, A.crotchY = M ? M.y - .12 : A.shY - .6;
|
|
147
|
+
let N = new a.PerspectiveCamera(30, l / u, .05, 100), P = O - .3;
|
|
148
|
+
N.position.set(0, P, 2.35), N.lookAt(0, P, 0);
|
|
149
|
+
let F = new a.Group();
|
|
150
|
+
c.add(F);
|
|
151
|
+
let I = "#5F7F63", L = (e, t, n) => new a.Vector3(e, t, n), R = {}, z = (e, t, n, r) => {
|
|
152
|
+
let i = new a.CatmullRomCurve3(e, t, "catmullrom", .5), o = new a.TubeGeometry(i, t ? 90 : 40, n, 8, t), s = new a.TubeGeometry(i, t ? 90 : 40, n * 2.2, 8, t), c = new a.MeshBasicMaterial({ color: r || I }), l = new a.MeshBasicMaterial({
|
|
153
|
+
color: r || I,
|
|
99
154
|
transparent: !0,
|
|
100
155
|
opacity: .15,
|
|
101
156
|
depthWrite: !1
|
|
102
157
|
});
|
|
103
|
-
|
|
104
|
-
},
|
|
105
|
-
let n = (
|
|
158
|
+
g.push(o, s, c, l), F.add(new a.Mesh(o, c)), F.add(new a.Mesh(s, l));
|
|
159
|
+
}, B = (e, t, n) => Math.max(.4, (e + n / (2 * Math.PI) * x) / (e + t)), re = (e, t, n) => Math.max(.4, (e + n / 2 * x) / (e + t)), ie = (e, t) => {
|
|
160
|
+
let n = (A.rx + .012) * e, r = n * .72, i = A.zF - A.zc - r * .4, a = [];
|
|
106
161
|
for (let e = 0; e < 36; e++) {
|
|
107
162
|
let t = e / 36 * Math.PI * 2, o = Math.sin(t);
|
|
108
|
-
a.push(
|
|
163
|
+
a.push(L(n * Math.cos(t), A.chestY - .012 * Math.max(0, o), A.zc + r * o + Math.max(0, i) * Math.max(0, o) * Math.max(0, o)));
|
|
109
164
|
}
|
|
110
|
-
|
|
111
|
-
},
|
|
112
|
-
let n = (
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
], !1, .65 * x, t),
|
|
120
|
-
},
|
|
165
|
+
z(a, !0, .7 * x, t), R.chest = L(-(n + x), A.chestY, A.zc);
|
|
166
|
+
}, ae = (e, t) => {
|
|
167
|
+
let n = (A.shHalf - .015) * e, r = E(A.shY, -.25, .25), i = r ? r.cz : A.zc;
|
|
168
|
+
z([
|
|
169
|
+
L(-(n + x), A.shY - .5 * x, i + 2 * x),
|
|
170
|
+
L(-n * .5, A.shY + 3.5 * x, i + 5 * x),
|
|
171
|
+
L(0, A.shY + 4.5 * x, i + 6 * x),
|
|
172
|
+
L(n * .5, A.shY + 3.5 * x, i + 5 * x),
|
|
173
|
+
L(n + x, A.shY - .5 * x, i + 2 * x)
|
|
174
|
+
], !1, .65 * x, t), R.shoulder_width = L(-(n + 1.5 * x), A.shY - .5 * x, i + 2 * x);
|
|
175
|
+
}, V = (e, t, n, r) => {
|
|
121
176
|
if (!e) return;
|
|
122
177
|
let i = (e.t.w / 2 + .008) * t, a = Math.min((e.t.z1 - e.t.z0) / 2 + .008, i * .78) * t, o = [];
|
|
123
178
|
for (let t = 0; t < 36; t++) {
|
|
124
179
|
let n = t / 36 * Math.PI * 2;
|
|
125
|
-
o.push(
|
|
180
|
+
o.push(L(e.t.cx + i * Math.cos(n), e.y, e.t.cz + a * Math.sin(n)));
|
|
126
181
|
}
|
|
127
|
-
|
|
128
|
-
},
|
|
182
|
+
z(o, !0, .7 * x, r), R[n] = L(e.t.cx - i - x, e.y, e.t.cz);
|
|
183
|
+
}, oe = (e, t) => {
|
|
129
184
|
let n = [];
|
|
130
|
-
for (let e =
|
|
185
|
+
for (let e = A.shY - .05; e > A.shY - .25; e -= .015) {
|
|
131
186
|
let t = T(e, .012);
|
|
132
187
|
if (!t.length) continue;
|
|
133
188
|
let r = t[0];
|
|
@@ -144,79 +199,79 @@ async function r(t, n, r = []) {
|
|
|
144
199
|
n.forEach(([e, t, n]) => {
|
|
145
200
|
r += t, i += t * t, a += e, o += e * t, s += n, c += n * t;
|
|
146
201
|
});
|
|
147
|
-
let u = l * i - r * r, d = (l * o - a * r) / u, f = (a - d * r) / l, p = (l * c - s * r) / u, m = (s - p * r) / l, h =
|
|
202
|
+
let u = l * i - r * r, d = (l * o - a * r) / u, f = (a - d * r) / l, p = (l * c - s * r) / u, m = (s - p * r) / l, h = A.shY - .02, g = L(f + d * h, h, m + p * h), _ = L(d, 1, p).normalize();
|
|
148
203
|
_.y > 0 && _.multiplyScalar(-1);
|
|
149
204
|
let v = g.clone().addScaledVector(_, Math.max(e, 4) * x * 1.1), y = [];
|
|
150
205
|
for (let e = 0; e <= 6; e++) {
|
|
151
206
|
let t = g.clone().lerp(v, e / 6);
|
|
152
207
|
t.x += .8 * x, t.z += .5 * x, y.push(t);
|
|
153
208
|
}
|
|
154
|
-
|
|
155
|
-
},
|
|
156
|
-
if (!
|
|
157
|
-
let n =
|
|
209
|
+
z(y, !1, .7 * x, t), R.sleeve_length = y[y.length - 1].clone();
|
|
210
|
+
}, se = (e, t) => {
|
|
211
|
+
if (!A.hipsRow) return;
|
|
212
|
+
let n = A.hipsRow.y - .1, r = n - Math.max(e, 4) * x * .9, i = [];
|
|
158
213
|
for (let e = 0; e <= 10; e++) {
|
|
159
|
-
let t = n + (r - n) * (e / 10), a = t >
|
|
160
|
-
i.push(
|
|
214
|
+
let t = n + (r - n) * (e / 10), a = t > A.crotchY ? E(t, -.165, .165) : E(t, .006, .16, .016);
|
|
215
|
+
i.push(L(a ? a.cx : 0, t, a ? a.z1 : A.zF));
|
|
161
216
|
}
|
|
162
|
-
|
|
163
|
-
},
|
|
164
|
-
let n =
|
|
217
|
+
z(i, !1, .65 * x, t), R.inseam = i[i.length - 1].clone();
|
|
218
|
+
}, ce = (e, t) => {
|
|
219
|
+
let n = A.shY - .02, r = n - Math.max(e, 4) * x * .9, i = [];
|
|
165
220
|
for (let e = 0; e <= 10; e++) {
|
|
166
221
|
let t = n + (r - n) * (e / 10), a = E(t, -.19, .19);
|
|
167
|
-
i.push(
|
|
222
|
+
i.push(L(a ? a.cx : 0, t, a ? a.z1 : A.zF));
|
|
168
223
|
}
|
|
169
|
-
|
|
170
|
-
},
|
|
171
|
-
for (;
|
|
172
|
-
let e =
|
|
224
|
+
z(i, !1, .65 * x, t), R.torso_length = i[i.length - 1].clone();
|
|
225
|
+
}, H = (e) => {
|
|
226
|
+
for (; F.children.length;) {
|
|
227
|
+
let e = F.children.pop();
|
|
173
228
|
e.geometry.dispose(), e.material.dispose();
|
|
174
229
|
}
|
|
175
|
-
|
|
176
|
-
for (let e in
|
|
230
|
+
g = [];
|
|
231
|
+
for (let e in R) delete R[e];
|
|
177
232
|
for (let t of e) {
|
|
178
|
-
let e = t.color ||
|
|
233
|
+
let e = t.color || I, n = U[t.key];
|
|
179
234
|
n && n(t.easeCm, e);
|
|
180
235
|
}
|
|
181
|
-
},
|
|
182
|
-
chest: (e, t) =>
|
|
236
|
+
}, U = {
|
|
237
|
+
chest: (e, t) => ie(B(A.rx, .012, e), t),
|
|
183
238
|
waist: (e, t) => {
|
|
184
|
-
|
|
239
|
+
A.waistRow && V(A.waistRow, B(A.waistRow.t.w / 2, .008, e), "waist", t);
|
|
185
240
|
},
|
|
186
241
|
hips: (e, t) => {
|
|
187
|
-
|
|
242
|
+
A.hipsRow && V(A.hipsRow, B(A.hipsRow.t.w / 2, .008, e), "hips", t);
|
|
188
243
|
},
|
|
189
|
-
shoulder_width: (e, t) => re(
|
|
190
|
-
sleeve_length: (e, t) =>
|
|
191
|
-
inseam: (e, t) =>
|
|
192
|
-
torso_length: (e, t) =>
|
|
244
|
+
shoulder_width: (e, t) => ae(re(A.shHalf, .015, e), t),
|
|
245
|
+
sleeve_length: (e, t) => oe(20 + e, t),
|
|
246
|
+
inseam: (e, t) => se(60 + e, t),
|
|
247
|
+
torso_length: (e, t) => ce(65 + e, t)
|
|
193
248
|
};
|
|
194
|
-
for (let t of e)
|
|
195
|
-
|
|
196
|
-
let
|
|
197
|
-
|
|
198
|
-
let
|
|
199
|
-
|
|
200
|
-
let
|
|
201
|
-
|
|
249
|
+
for (let t of e) U[t] || console.warn(`[VirtualTryOn] mannequin has no band geometry for measurement "${t}"`);
|
|
250
|
+
H(i);
|
|
251
|
+
let W = document.createElement("div");
|
|
252
|
+
W.style.cssText = `position:absolute;inset:0;z-index:2;pointer-events:none;font-family:'${r}',system-ui,sans-serif;`;
|
|
253
|
+
let G = "http://www.w3.org/2000/svg", K = document.createElementNS(G, "svg");
|
|
254
|
+
K.setAttribute("width", String(l)), K.setAttribute("height", String(u)), K.style.cssText = "position:absolute;inset:0;", W.appendChild(K), t.appendChild(W);
|
|
255
|
+
let q = i.filter((e) => R[e.key]), J = {}, Y = {}, X = {}, Z = {};
|
|
256
|
+
q.forEach((e) => {
|
|
202
257
|
let t = document.createElement("div");
|
|
203
258
|
t.style.cssText = "position:absolute;display:flex;align-items:center;gap:6px;background:rgba(255,255,255,0.94);border-radius:999px;padding:4px 10px 4px 5px;box-shadow:0 6px 20px rgba(28,28,22,0.12);white-space:nowrap;";
|
|
204
259
|
let n = document.createElement("span");
|
|
205
260
|
n.style.cssText = "width:16px;height:16px;border-radius:50%;background:#6F8F72;color:#FAF7ED;font-size:9.5px;font-weight:700;flex:none;display:inline-flex;align-items:center;justify-content:center;", n.textContent = e.letter;
|
|
206
261
|
let r = document.createElement("span");
|
|
207
|
-
r.style.cssText = `font-size:11px;font-weight:700;color:${e.color || "#5F7F63"};`, r.textContent = e.verdict || "", t.appendChild(n), t.appendChild(r),
|
|
208
|
-
let i = document.createElementNS(
|
|
209
|
-
i.setAttribute("stroke", "rgba(28,28,22,0.30)"), i.setAttribute("stroke-width", "1"),
|
|
210
|
-
let a = document.createElementNS(
|
|
211
|
-
a.setAttribute("r", "2.2"), a.setAttribute("fill", "#1c1c16"), a.setAttribute("fill-opacity", "0.55"),
|
|
262
|
+
r.style.cssText = `font-size:11px;font-weight:700;color:${e.color || "#5F7F63"};`, r.textContent = e.verdict || "", t.appendChild(n), t.appendChild(r), W.appendChild(t);
|
|
263
|
+
let i = document.createElementNS(G, "line");
|
|
264
|
+
i.setAttribute("stroke", "rgba(28,28,22,0.30)"), i.setAttribute("stroke-width", "1"), K.appendChild(i);
|
|
265
|
+
let a = document.createElementNS(G, "circle");
|
|
266
|
+
a.setAttribute("r", "2.2"), a.setAttribute("fill", "#1c1c16"), a.setAttribute("fill-opacity", "0.55"), K.appendChild(a), J[e.key] = t, Y[e.key] = r, X[e.key] = i, Z[e.key] = a;
|
|
212
267
|
});
|
|
213
|
-
let
|
|
268
|
+
let le = () => {
|
|
214
269
|
let e = t.clientWidth, n = t.clientHeight;
|
|
215
270
|
if (!e || !n) return;
|
|
216
|
-
|
|
271
|
+
K.setAttribute("width", String(e)), K.setAttribute("height", String(n));
|
|
217
272
|
let r = {};
|
|
218
|
-
|
|
219
|
-
let i =
|
|
273
|
+
q.forEach((t) => {
|
|
274
|
+
let i = R[t.key].clone().project(N);
|
|
220
275
|
r[t.key] = {
|
|
221
276
|
x: (i.x * .5 + .5) * e,
|
|
222
277
|
y: (-i.y * .5 + .5) * n
|
|
@@ -226,41 +281,41 @@ async function r(t, n, r = []) {
|
|
|
226
281
|
left: [],
|
|
227
282
|
right: []
|
|
228
283
|
};
|
|
229
|
-
|
|
284
|
+
q.forEach((t) => (r[t.key].x < e / 2 ? i.left : i.right).push(t)), Object.entries(i).forEach(([t, i]) => {
|
|
230
285
|
i.sort((e, t) => r[e.key].y - r[t.key].y);
|
|
231
286
|
let a = 16;
|
|
232
287
|
i.forEach((i) => {
|
|
233
288
|
let o = r[i.key], s = Math.max(o.y, a);
|
|
234
289
|
s = Math.min(s, n - 24), a = s + 34;
|
|
235
|
-
let c =
|
|
290
|
+
let c = J[i.key];
|
|
236
291
|
c.style.top = `${s - 13}px`, t === "left" ? (c.style.left = "10px", c.style.right = "auto") : (c.style.right = "10px", c.style.left = "auto");
|
|
237
292
|
let l = c.offsetWidth, u = t === "left" ? 10 + l + 3 : e - 10 - l - 3;
|
|
238
293
|
X[i.key].setAttribute("x1", String(u)), X[i.key].setAttribute("y1", String(s)), X[i.key].setAttribute("x2", String(o.x)), X[i.key].setAttribute("y2", String(o.y)), Z[i.key].setAttribute("cx", String(o.x)), Z[i.key].setAttribute("cy", String(o.y));
|
|
239
294
|
});
|
|
240
295
|
});
|
|
241
296
|
}, Q = () => {
|
|
242
|
-
|
|
297
|
+
s || (d.render(c, N), le());
|
|
243
298
|
};
|
|
244
299
|
Q();
|
|
245
|
-
let
|
|
300
|
+
let ue = new ResizeObserver(() => {
|
|
246
301
|
let e = t.clientWidth, n = t.clientHeight;
|
|
247
|
-
!e || !n || (
|
|
302
|
+
!e || !n || (d.setSize(e, n), N.aspect = e / n, N.updateProjectionMatrix(), Q());
|
|
248
303
|
});
|
|
249
|
-
|
|
250
|
-
let $ =
|
|
304
|
+
ue.observe(t);
|
|
305
|
+
let $ = i.slice();
|
|
251
306
|
return {
|
|
252
307
|
destroy() {
|
|
253
|
-
|
|
308
|
+
s || (s = !0, ue.disconnect(), h.forEach((e) => e.dispose()), g.forEach((e) => e.dispose()), d.dispose(), d.domElement.remove(), W.remove());
|
|
254
309
|
},
|
|
255
310
|
updateMany(e) {
|
|
256
|
-
if (!(
|
|
311
|
+
if (!(s || !e.length)) {
|
|
257
312
|
for (let t of e) {
|
|
258
313
|
let e = $.findIndex((e) => e.key === t.key);
|
|
259
314
|
e !== -1 && ($[e] = t);
|
|
260
315
|
}
|
|
261
|
-
|
|
316
|
+
H($);
|
|
262
317
|
for (let t of e) {
|
|
263
|
-
let e =
|
|
318
|
+
let e = Y[t.key];
|
|
264
319
|
e && (e.textContent = t.verdict || "", e.style.color = t.color || "#5F7F63");
|
|
265
320
|
}
|
|
266
321
|
Q();
|
|
@@ -269,4 +324,4 @@ async function r(t, n, r = []) {
|
|
|
269
324
|
};
|
|
270
325
|
}
|
|
271
326
|
//#endregion
|
|
272
|
-
export {
|
|
327
|
+
export { l as mountMannequin3D };
|