@realsee/dnalogel 3.78.0-alpha.3 → 3.78.0-alpha.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/dist/PanoTagPlugin/utils/tagPosition.d.ts +2 -1
- package/dist/index.cjs.js +40 -40
- package/dist/index.js +399 -395
- package/dist/index.umd.js +40 -40
- package/libs/PanoTagPlugin/controller/Tag/BaseTag.js +47 -47
- package/libs/PanoTagPlugin/controller/Tag/BoxTag.js +68 -65
- package/libs/PanoTagPlugin/utils/index.js +31 -30
- package/libs/PanoTagPlugin/utils/tagPosition.d.ts +2 -1
- package/libs/PanoTagPlugin/utils/tagPosition.js +34 -32
- package/libs/base/BasePlugin.js +1 -1
- package/libs/shared-utils/logger.js +1 -1
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
var Q = Object.defineProperty, Y = Object.defineProperties;
|
|
2
2
|
var ee = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var V = Object.getOwnPropertySymbols;
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var $ = Object.prototype.hasOwnProperty, z = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var P = Math.pow, D = (g, t, e) => t in g ? Q(g, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : g[t] = e, y = (g, t) => {
|
|
6
6
|
for (var e in t || (t = {}))
|
|
7
|
-
|
|
7
|
+
$.call(t, e) && D(g, e, t[e]);
|
|
8
8
|
if (V)
|
|
9
9
|
for (var e of V(t))
|
|
10
10
|
z.call(t, e) && D(g, e, t[e]);
|
|
@@ -13,7 +13,7 @@ var k = Math.pow, D = (g, t, e) => t in g ? Q(g, t, { enumerable: !0, configurab
|
|
|
13
13
|
var W = (g, t) => {
|
|
14
14
|
var e = {};
|
|
15
15
|
for (var i in g)
|
|
16
|
-
|
|
16
|
+
$.call(g, i) && t.indexOf(i) < 0 && (e[i] = g[i]);
|
|
17
17
|
if (g != null && V)
|
|
18
18
|
for (var i of V(g))
|
|
19
19
|
t.indexOf(i) < 0 && z.call(g, i) && (e[i] = g[i]);
|
|
@@ -41,13 +41,13 @@ import { calculateTagConfig as R } from "../../utils/tag/calculateTagConfig.js";
|
|
|
41
41
|
import { getTagStickType as ie } from "../../utils/tag/format.js";
|
|
42
42
|
import "../../../shared-utils/tag.js";
|
|
43
43
|
import { isPanoramaLike as E, isModelLike as B } from "../../../shared-utils/five/mode.js";
|
|
44
|
-
import * as
|
|
44
|
+
import * as k from "three";
|
|
45
45
|
import "../../../vendor/hammerjs/hammer.js";
|
|
46
46
|
import "../../../shared-utils/three/PointSelector/index.js";
|
|
47
47
|
import { centerPoint as ne } from "../../../shared-utils/three/centerPoint.js";
|
|
48
48
|
import "../../../shared-utils/three/CSS3DRenderer/index.js";
|
|
49
49
|
import "../../../CSS3DRenderPlugin/utils/generateBehindFiveElement.js";
|
|
50
|
-
import { anyPositionToVector3 as
|
|
50
|
+
import { anyPositionToVector3 as w } from "../../../shared-utils/positionToVector3.js";
|
|
51
51
|
import { toArray as se } from "../../../shared-utils/util.js";
|
|
52
52
|
import "@realsee/five/line";
|
|
53
53
|
import { isNil as J, notNil as H } from "../../../shared-utils/isNil.js";
|
|
@@ -58,19 +58,19 @@ import "../../../vendor/@tweenjs/tween/dist/tween.esm.js.js";
|
|
|
58
58
|
import "../../../CSS3DRenderPlugin/utils/three/CSS3DRender.js";
|
|
59
59
|
import "../../../vendor/earcut/src/earcut.js";
|
|
60
60
|
import { vectorToCoordinates as le } from "../../../shared-utils/vectorToCoordinate.js";
|
|
61
|
-
import { transformPosition as
|
|
61
|
+
import { transformPosition as O } from "../../../shared-utils/five/transformPosition.js";
|
|
62
62
|
import { lookPoint as ae } from "../../../shared-utils/five/lookPoint.js";
|
|
63
63
|
import { uuid as fe } from "../../../shared-utils/uuid.js";
|
|
64
64
|
import "../../../shared-utils/five/FivePuppet.js";
|
|
65
|
-
import { objectAssignDeepExports as
|
|
65
|
+
import { objectAssignDeepExports as T } from "../../../vendor/object-assign-deep/objectAssignDeep.js";
|
|
66
66
|
import { getTagPosition as q, getTagCenterPosition as X } from "../../utils/tagPosition.js";
|
|
67
67
|
import { checkRange as S } from "../../utils/checkRange.js";
|
|
68
|
-
import { isMediaPlaneTag as Z, isMediaModelTag as
|
|
68
|
+
import { isMediaPlaneTag as Z, isMediaModelTag as _ } from "../../utils/tag/tagCheck.js";
|
|
69
69
|
import { getUrlExt as G } from "../../../shared-utils/url/getUrl.js";
|
|
70
70
|
import { getFloorIndex as de } from "../../../shared-utils/five/getFloorIndex.js";
|
|
71
71
|
import { safeObj as K } from "../../../shared-utils/safeObj.js";
|
|
72
72
|
import { Cache as ce } from "../../utils/Cache.js";
|
|
73
|
-
import { _raycaster as
|
|
73
|
+
import { _raycaster as N } from "../../../shared-utils/three/temp.js";
|
|
74
74
|
import { withResolvers as ue } from "../../../shared-utils/promise/withResolvers.js";
|
|
75
75
|
import "../../../shared-utils/typescript/entries.js";
|
|
76
76
|
import "../../utils/tag/adaptConfig.js";
|
|
@@ -189,14 +189,14 @@ class Jt {
|
|
|
189
189
|
const s = JSON.parse(JSON.stringify(e.data)), o = (f = e.initialConfig) != null ? f : e.config ? JSON.parse(JSON.stringify(e.config)) : {};
|
|
190
190
|
e.initialConfig = o;
|
|
191
191
|
const l = R(e, t.config), r = this.getConfig(e);
|
|
192
|
-
e.config = r, this.id = (m = e.id) != null ? m : fe(), this.enabled = (p = e.enabled) != null ? p : !0, this.contentType = e.contentType, this.hoverEnabled = (c = (d = r.popoverConfig) == null ? void 0 : d.enabled) != null ? c : !0, this.data = (u = r.initialData) != null && u.important ?
|
|
192
|
+
e.config = r, this.id = (m = e.id) != null ? m : fe(), this.enabled = (p = e.enabled) != null ? p : !0, this.contentType = e.contentType, this.hoverEnabled = (c = (d = r.popoverConfig) == null ? void 0 : d.enabled) != null ? c : !0, this.data = (u = r.initialData) != null && u.important ? T(e.data, s, r.initialData) : T(e.data, r.initialData, s);
|
|
193
193
|
let n;
|
|
194
194
|
typeof r.unfoldedConfig == "object" ? r.unfoldedConfig.keep === "unfolded" ? n = !0 : r.unfoldedConfig.keep === "folded" ? n = !1 : n = !this.can("fold") : n = !this.can("fold"), this.state = y({
|
|
195
195
|
visible: void 0,
|
|
196
196
|
unfolded: n
|
|
197
197
|
}, r.initialState), this.isPopoverConfigEnabled() && (this.state.unfolded = !1), this.normalLineLength = (b = (v = e.style) == null ? void 0 : v.point) == null ? void 0 : b.normalLen, this.originPosition = e.position, e.originPosition = this.originPosition, this.position = (() => {
|
|
198
198
|
var U;
|
|
199
|
-
const h = e.originPosition,
|
|
199
|
+
const h = e.originPosition, x = t.workUtil.transform;
|
|
200
200
|
if (e.stickType === "3DBox") {
|
|
201
201
|
if (!h)
|
|
202
202
|
return {
|
|
@@ -204,25 +204,25 @@ class Jt {
|
|
|
204
204
|
end: [0, 0, 0],
|
|
205
205
|
rotation: [0, 0, 0]
|
|
206
206
|
};
|
|
207
|
-
const { start:
|
|
207
|
+
const { start: C, end: A, rotation: F } = h;
|
|
208
208
|
return {
|
|
209
|
-
start:
|
|
210
|
-
end:
|
|
211
|
-
rotation:
|
|
209
|
+
start: w(C.map((I) => Number(I))).toArray(),
|
|
210
|
+
end: w(A.map((I) => Number(I))).toArray(),
|
|
211
|
+
rotation: w(F.map((I) => Number(I))).toArray()
|
|
212
212
|
};
|
|
213
213
|
}
|
|
214
214
|
if (e.stickType === "Polygon")
|
|
215
|
-
return h ? h.map(
|
|
215
|
+
return h ? h.map(w).map((C) => O(C, x).toArray()) : [];
|
|
216
216
|
if (!h)
|
|
217
217
|
return;
|
|
218
|
-
let
|
|
219
|
-
if (Array.isArray(h) && h.length === 4 ?
|
|
220
|
-
const
|
|
221
|
-
|
|
218
|
+
let M = h;
|
|
219
|
+
if (Array.isArray(h) && h.length === 4 ? M = h.map(w).map((C) => O(C, x).toArray()) : M = O(w(h), x).toArray(), (e.stickType === "2DPoint" || e.stickType === "3DPoint") && ((U = r == null ? void 0 : r.tagNormalLineConfig) != null && U.enabled) && e.normal && this.normalLineLength) {
|
|
220
|
+
const C = new k.Vector3().fromArray(e.normal);
|
|
221
|
+
M = new k.Vector3().fromArray(M).clone().add(C.clone().setLength(this.normalLineLength)).toArray();
|
|
222
222
|
}
|
|
223
|
-
return
|
|
223
|
+
return M;
|
|
224
224
|
})(), this.matrix = e.matrix ? (() => {
|
|
225
|
-
const h = new
|
|
225
|
+
const h = new k.Matrix4().fromArray(e.matrix);
|
|
226
226
|
return h.premultiply(t.workUtil.transform), h.elements;
|
|
227
227
|
})() : e.matrix, this.initialConfig = o, this.computedConfig = l, this.stickType = i, this.config = e.config, this.fiveState = e.fiveState, this.normal = e.normal, this.cache = new ce(), this.hooks = new te(), Object.keys(e).forEach((h) => {
|
|
228
228
|
this[h] === void 0 && e[h] !== void 0 && (this[h] = e[h]);
|
|
@@ -325,8 +325,8 @@ class Jt {
|
|
|
325
325
|
c.push(this.dom), c.push((b = (v = this.tag3DContentSvelte) == null ? void 0 : v.css3DInstance) == null ? void 0 : b.container), c.push((h = this.model) == null ? void 0 : h.object), c.push(this.mediaPlane), c.push(this.boxShape), c.push(this.polygonShape);
|
|
326
326
|
const u = this.getAdditionalBlinkTargets();
|
|
327
327
|
if (u) {
|
|
328
|
-
const
|
|
329
|
-
c.push(...
|
|
328
|
+
const x = Array.isArray(u) ? u : [u];
|
|
329
|
+
c.push(...x);
|
|
330
330
|
}
|
|
331
331
|
return c.filter(Boolean);
|
|
332
332
|
})();
|
|
@@ -398,7 +398,7 @@ class Jt {
|
|
|
398
398
|
* @param deepMerge 是否深度合并 data,默认为 true
|
|
399
399
|
*/
|
|
400
400
|
setData(t, e = !0) {
|
|
401
|
-
e ? this.data =
|
|
401
|
+
e ? this.data = T(this.data, t) : this.data = y(y({}, this.data), t), this.hooks.emit("dataChanged", this.data);
|
|
402
402
|
}
|
|
403
403
|
/**
|
|
404
404
|
* @description 修改标签位置
|
|
@@ -411,7 +411,7 @@ class Jt {
|
|
|
411
411
|
* @param deepMerge 是否深度合并 data,默认为 true
|
|
412
412
|
*/
|
|
413
413
|
set(t, e = !0) {
|
|
414
|
-
this.plugin.tagsLengthWillUpdate = !0, e ?
|
|
414
|
+
this.plugin.tagsLengthWillUpdate = !0, e ? T(this, t) : Object.assign(this, t), this.cache.clear();
|
|
415
415
|
}
|
|
416
416
|
updateConfig() {
|
|
417
417
|
var i;
|
|
@@ -420,7 +420,7 @@ class Jt {
|
|
|
420
420
|
const e = this.getConfig();
|
|
421
421
|
if (this.config = e, this.config.initialData) {
|
|
422
422
|
const s = JSON.parse(JSON.stringify(this.data));
|
|
423
|
-
this.data = (i = e.initialData) != null && i.important ?
|
|
423
|
+
this.data = (i = e.initialData) != null && i.important ? T(this.data, s, e.initialData) : T(this.data, e.initialData, s);
|
|
424
424
|
}
|
|
425
425
|
this.cache.clear();
|
|
426
426
|
}
|
|
@@ -450,17 +450,17 @@ class Jt {
|
|
|
450
450
|
if (!i || !i.start)
|
|
451
451
|
return 1 / 0;
|
|
452
452
|
const s = i.start;
|
|
453
|
-
return
|
|
453
|
+
return P(s[0] - t.x, 2) + P(s[1] - t.y, 2) + P(s[2] - t.z, 2);
|
|
454
454
|
}
|
|
455
455
|
if (this.stickType === "Polygon") {
|
|
456
456
|
const i = this.position;
|
|
457
457
|
if (!i || i.length === 0)
|
|
458
458
|
return 1 / 0;
|
|
459
459
|
const s = i[0];
|
|
460
|
-
return
|
|
460
|
+
return P(s[0] - t.x, 2) + P(s[1] - t.y, 2) + P(s[2] - t.z, 2);
|
|
461
461
|
}
|
|
462
462
|
let e;
|
|
463
|
-
return this.position || console.log(this, "no position"), Array.isArray(this.position[0]) ? e = this.position[0] : e = this.position,
|
|
463
|
+
return this.position || console.log(this, "no position"), Array.isArray(this.position[0]) ? e = this.position[0] : e = this.position, P(e[0] - t.x, 2) + P(e[1] - t.y, 2) + P(e[2] - t.z, 2);
|
|
464
464
|
}
|
|
465
465
|
getVisible(t) {
|
|
466
466
|
if (!this.enabled || !this.plugin.state.enabled || !this.fiveUtil.model)
|
|
@@ -519,7 +519,7 @@ class Jt {
|
|
|
519
519
|
if (i[0].type === "Image")
|
|
520
520
|
return G(i[0].url) === "gif" ? "Dom" : "Mesh";
|
|
521
521
|
}
|
|
522
|
-
} else if (
|
|
522
|
+
} else if (_(this))
|
|
523
523
|
return i.length === 1 && i[0].type === "Image" ? G(i[0].url) === "gif" ? "Dom" : "Mesh" : "BehindDom";
|
|
524
524
|
}
|
|
525
525
|
})();
|
|
@@ -647,21 +647,21 @@ class Jt {
|
|
|
647
647
|
);
|
|
648
648
|
let l = 0, r = 0;
|
|
649
649
|
for (const d of o) {
|
|
650
|
-
const c = new
|
|
650
|
+
const c = new k.Vector3().subVectors(d, s).normalize();
|
|
651
651
|
let u;
|
|
652
|
-
|
|
653
|
-
const [v] = this.fiveUtil.model.intersectRaycaster(
|
|
652
|
+
N.set(s, c);
|
|
653
|
+
const [v] = this.fiveUtil.model.intersectRaycaster(N);
|
|
654
654
|
u = v == null ? void 0 : v.distance;
|
|
655
655
|
const b = (() => {
|
|
656
|
-
if (!
|
|
656
|
+
if (!_(this))
|
|
657
657
|
return;
|
|
658
|
-
const
|
|
659
|
-
var
|
|
660
|
-
return (
|
|
661
|
-
}).filter(H), [A] =
|
|
658
|
+
const C = this.plugin.tags.filter(_).map((F) => {
|
|
659
|
+
var I;
|
|
660
|
+
return (I = F.model) == null ? void 0 : I.object;
|
|
661
|
+
}).filter(H), [A] = N.intersectObjects(C, !0);
|
|
662
662
|
return A;
|
|
663
|
-
})(), h = s.distanceTo(d),
|
|
664
|
-
u = Math.min(u != null ? u : 1 / 0, (m = b == null ? void 0 : b.distance) != null ? m : 1 / 0), u +
|
|
663
|
+
})(), h = s.distanceTo(d), x = (f = e.distanceAccuracy) != null ? f : 0.01;
|
|
664
|
+
u = Math.min(u != null ? u : 1 / 0, (m = b == null ? void 0 : b.distance) != null ? m : 1 / 0), u + x >= h ? l++ : r++;
|
|
665
665
|
const U = (p = e.needPassed) != null ? p : 1;
|
|
666
666
|
if (l >= U)
|
|
667
667
|
return { value: !0 };
|
|
@@ -747,16 +747,16 @@ class Jt {
|
|
|
747
747
|
if (t.autoUnfold.strategy === "FoldWhenMove")
|
|
748
748
|
return !1;
|
|
749
749
|
if (t.autoUnfold.strategy === "ScreenCenter") {
|
|
750
|
-
const s = this.plugin.filterPointTag, o = new
|
|
750
|
+
const s = this.plugin.filterPointTag, o = new k.Matrix4();
|
|
751
751
|
o.multiplyMatrices(this.five.camera.projectionMatrix, this.five.camera.matrixWorldInverse);
|
|
752
|
-
const l = new
|
|
752
|
+
const l = new k.Frustum();
|
|
753
753
|
l.setFromProjectionMatrix(o);
|
|
754
|
-
const r = this.five.camera.getWorldDirection(new
|
|
754
|
+
const r = this.five.camera.getWorldDirection(new k.Vector3()), f = s.filter((p) => {
|
|
755
755
|
var v, b;
|
|
756
756
|
if (!p.currentVisible)
|
|
757
757
|
return !1;
|
|
758
758
|
const d = p.getConfig().unfoldedConfig;
|
|
759
|
-
if (p.manuallyOperated || typeof d != "object" || (d == null ? void 0 : d.autoUnfold) === !1 || ((v = d == null ? void 0 : d.autoUnfold) == null ? void 0 : v.strategy) !== "ScreenCenter" || d.keep || ((b = d.autoUnfold) == null ? void 0 : b.enable) === !1 || !l.containsPoint(new
|
|
759
|
+
if (p.manuallyOperated || typeof d != "object" || (d == null ? void 0 : d.autoUnfold) === !1 || ((v = d == null ? void 0 : d.autoUnfold) == null ? void 0 : v.strategy) !== "ScreenCenter" || d.keep || ((b = d.autoUnfold) == null ? void 0 : b.enable) === !1 || !l.containsPoint(new k.Vector3().fromArray(p.position)))
|
|
760
760
|
return !1;
|
|
761
761
|
const u = d.autoUnfold.distance;
|
|
762
762
|
if (u) {
|
|
@@ -766,7 +766,7 @@ class Jt {
|
|
|
766
766
|
}
|
|
767
767
|
return !0;
|
|
768
768
|
}).sort((p, d) => {
|
|
769
|
-
const c = new
|
|
769
|
+
const c = new k.Vector3().fromArray(p.position), u = new k.Vector3().fromArray(d.position);
|
|
770
770
|
return r.angleTo(c.sub(this.five.camera.position)) - r.angleTo(u.sub(this.five.camera.position));
|
|
771
771
|
}).findIndex((p) => p.id === this.id);
|
|
772
772
|
if (f === -1 || f <= ((i = t.autoUnfold.maxNumber) != null ? i : 1) - 1 === !1)
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
for (var t in
|
|
6
|
-
|
|
7
|
-
if (
|
|
8
|
-
for (var t of
|
|
9
|
-
|
|
1
|
+
var P = Object.defineProperty;
|
|
2
|
+
var b = Object.getOwnPropertySymbols;
|
|
3
|
+
var E = Object.prototype.hasOwnProperty, B = Object.prototype.propertyIsEnumerable;
|
|
4
|
+
var S = (a, n, t) => n in a ? P(a, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[n] = t, y = (a, n) => {
|
|
5
|
+
for (var t in n || (n = {}))
|
|
6
|
+
E.call(n, t) && S(a, t, n[t]);
|
|
7
|
+
if (b)
|
|
8
|
+
for (var t of b(n))
|
|
9
|
+
B.call(n, t) && S(a, t, n[t]);
|
|
10
10
|
return a;
|
|
11
11
|
};
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
var e = (
|
|
12
|
+
var f = (a, n, t) => (S(a, typeof n != "symbol" ? n + "" : n, t), t);
|
|
13
|
+
var g = (a, n, t) => new Promise((i, o) => {
|
|
14
|
+
var e = (p) => {
|
|
15
15
|
try {
|
|
16
|
-
|
|
17
|
-
} catch (
|
|
18
|
-
o(
|
|
16
|
+
l(t.next(p));
|
|
17
|
+
} catch (h) {
|
|
18
|
+
o(h);
|
|
19
19
|
}
|
|
20
|
-
},
|
|
20
|
+
}, s = (p) => {
|
|
21
21
|
try {
|
|
22
|
-
|
|
23
|
-
} catch (
|
|
24
|
-
o(
|
|
22
|
+
l(t.throw(p));
|
|
23
|
+
} catch (h) {
|
|
24
|
+
o(h);
|
|
25
25
|
}
|
|
26
|
-
},
|
|
27
|
-
|
|
26
|
+
}, l = (p) => p.done ? i(p.value) : Promise.resolve(p.value).then(e, s);
|
|
27
|
+
l((t = t.apply(a, n)).next());
|
|
28
28
|
});
|
|
29
|
-
import { BaseTag as
|
|
29
|
+
import { BaseTag as z } from "./BaseTag.js";
|
|
30
30
|
import * as r from "three";
|
|
31
|
-
import { Sculpt as
|
|
32
|
-
import { Box as
|
|
31
|
+
import { Sculpt as T } from "../../../Sculpt/index.js";
|
|
32
|
+
import { Box as D } from "../../../Sculpt/Objects/Box/index.js";
|
|
33
33
|
import "../../../shared-utils/tag.js";
|
|
34
34
|
import "../../../vendor/hammerjs/hammer.js";
|
|
35
35
|
import "../../../shared-utils/three/PointSelector/index.js";
|
|
@@ -43,10 +43,11 @@ import "../../../shared-utils/three/blink.js";
|
|
|
43
43
|
import "../../../vendor/@tweenjs/tween/dist/tween.esm.js.js";
|
|
44
44
|
import "../../../CSS3DRenderPlugin/utils/three/CSS3DRender.js";
|
|
45
45
|
import "../../../vendor/earcut/src/earcut.js";
|
|
46
|
-
import {
|
|
46
|
+
import { transformPosition as x } from "../../../shared-utils/five/transformPosition.js";
|
|
47
|
+
import { uuid as M } from "../../../shared-utils/uuid.js";
|
|
47
48
|
import "../../../shared-utils/five/FivePuppet.js";
|
|
48
|
-
import { getBoxCorners as
|
|
49
|
-
import { sculptDataToBoxPosition as
|
|
49
|
+
import { getBoxCorners as A, applyMatrixToPoints as F } from "../../utils/tagPosition.js";
|
|
50
|
+
import { sculptDataToBoxPosition as U } from "../../utils/sculptDataToBoxPosition.js";
|
|
50
51
|
import "../../../shared-utils/Subscribe.js";
|
|
51
52
|
import "../../utils/tag/calculateTagConfig.js";
|
|
52
53
|
import "../../../vendor/object-assign-deep/objectAssignDeep.js";
|
|
@@ -62,7 +63,6 @@ import "../../../shared-utils/util.js";
|
|
|
62
63
|
import "../../../shared-utils/isNil.js";
|
|
63
64
|
import "../../../shared-utils/vectorToCoordinate.js";
|
|
64
65
|
import "../../../shared-utils/formatRad.js";
|
|
65
|
-
import "../../../shared-utils/five/transformPosition.js";
|
|
66
66
|
import "../../../shared-utils/five/lookPoint.js";
|
|
67
67
|
import "../../../shared-utils/Utils/FiveUtil.js";
|
|
68
68
|
import "../../../shared-utils/Utils/BaseUtil.js";
|
|
@@ -210,25 +210,25 @@ import "../../../shared-utils/forReverseEach.js";
|
|
|
210
210
|
import "../../../Sculpt/Objects/Line/index.js";
|
|
211
211
|
import "../../../Sculpt/Editors/BoxMeshEditor.js";
|
|
212
212
|
import "../../../Sculpt/Meshes/Box.js";
|
|
213
|
-
class
|
|
213
|
+
class se extends z {
|
|
214
214
|
constructor(t, i) {
|
|
215
215
|
super(t, i);
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
216
|
+
f(this, "tagStyle");
|
|
217
|
+
f(this, "clickEventDispose");
|
|
218
|
+
f(this, "domClickDispose");
|
|
219
|
+
f(this, "screenPosition", null);
|
|
220
220
|
this.tagStyle = i.style, this.initializeSculptBox(), this.updateVisible();
|
|
221
221
|
}
|
|
222
222
|
/**
|
|
223
223
|
* 获取 Box 样式配置(合并用户配置和默认值)
|
|
224
224
|
*/
|
|
225
225
|
getBoxStyle() {
|
|
226
|
-
var i, o, e,
|
|
226
|
+
var i, o, e, s;
|
|
227
227
|
const t = ((i = this.tagStyle) == null ? void 0 : i.boxOrPolygon) || {};
|
|
228
228
|
return {
|
|
229
229
|
color: (o = t.color) != null ? o : 16777215,
|
|
230
230
|
opacity: (e = t.opacity) != null ? e : 0.4,
|
|
231
|
-
lineColor: (
|
|
231
|
+
lineColor: (s = t.color) != null ? s : 16777215,
|
|
232
232
|
lineWidth: 1
|
|
233
233
|
};
|
|
234
234
|
}
|
|
@@ -245,7 +245,7 @@ class ie extends C {
|
|
|
245
245
|
* 更新标签数据
|
|
246
246
|
*/
|
|
247
247
|
set(t, i = !0) {
|
|
248
|
-
super.set(t, i), t.style && (this.tagStyle =
|
|
248
|
+
super.set(t, i), t.style && (this.tagStyle = y(y({}, this.tagStyle), t.style)), t.position && (this.boxShape ? this.updateSculptBox() : this.initializeSculptBox()), t.style && this.boxShape && this.updateBoxStyle();
|
|
249
249
|
}
|
|
250
250
|
/**
|
|
251
251
|
* 设置标签数据
|
|
@@ -257,21 +257,21 @@ class ie extends C {
|
|
|
257
257
|
* 获取盒子的中心点
|
|
258
258
|
*/
|
|
259
259
|
getCenter() {
|
|
260
|
-
const t = this.
|
|
260
|
+
const t = this.position;
|
|
261
261
|
if (!(t != null && t.start) || !(t != null && t.end))
|
|
262
262
|
return [0, 0, 0];
|
|
263
|
-
const i = t.end.map((
|
|
264
|
-
return
|
|
263
|
+
const i = t.end.map((h) => Number(h)), o = t.start.map((h) => Number(h)), e = i[0] / 2 + o[0] / 2, s = i[1] / 2 + o[1] / 2, l = i[2] / 2 + o[2] / 2, p = new r.Vector3(e, s, l);
|
|
264
|
+
return x(p, this.workUtil.transform).toArray();
|
|
265
265
|
}
|
|
266
266
|
/**
|
|
267
267
|
* 获取盒子的8个角点坐标
|
|
268
268
|
*/
|
|
269
269
|
getCorners() {
|
|
270
270
|
if (this.boxShape) {
|
|
271
|
-
const t = this.boxShape.data, i = t.points.map((
|
|
271
|
+
const t = this.boxShape.data, i = t.points.map((s) => u(s)), o = new r.Vector3().subVectors(
|
|
272
272
|
u(t.heightPoint),
|
|
273
273
|
i[0]
|
|
274
|
-
), e = i.map((
|
|
274
|
+
), e = i.map((s) => s.clone().add(o));
|
|
275
275
|
return [...i, ...e];
|
|
276
276
|
}
|
|
277
277
|
return [];
|
|
@@ -295,13 +295,13 @@ class ie extends C {
|
|
|
295
295
|
const t = this.position;
|
|
296
296
|
if (!(t != null && t.start) || !(t != null && t.end) || !(t != null && t.rotation))
|
|
297
297
|
return;
|
|
298
|
-
const i = new
|
|
298
|
+
const i = new T(this.five, void 0, {
|
|
299
299
|
magnifier: null
|
|
300
300
|
});
|
|
301
301
|
i.clear(), i.group.removeFromParent();
|
|
302
|
-
const o = this.boxPositionToSculptData(t), e = this.getBoxStyle(),
|
|
302
|
+
const o = this.boxPositionToSculptData(t), e = this.getBoxStyle(), s = new D(
|
|
303
303
|
{
|
|
304
|
-
id:
|
|
304
|
+
id: M(),
|
|
305
305
|
type: "Box",
|
|
306
306
|
points: o.bottomPoints,
|
|
307
307
|
heightPoint: o.heightPoint,
|
|
@@ -313,9 +313,9 @@ class ie extends C {
|
|
|
313
313
|
// occlusionMode: 'translucence' as any,
|
|
314
314
|
}
|
|
315
315
|
);
|
|
316
|
-
|
|
316
|
+
s.visible = this.visible, this.plugin.imagePlaneGroup.add(s), this.boxShape = s, s.editor.hooks.on("objectUpdate", () => {
|
|
317
317
|
this.syncBoxPositionFromSculpt();
|
|
318
|
-
}),
|
|
318
|
+
}), s.editor.disable(), this.setupClickEvents();
|
|
319
319
|
}
|
|
320
320
|
/**
|
|
321
321
|
* 设置点击事件
|
|
@@ -366,7 +366,7 @@ class ie extends C {
|
|
|
366
366
|
* 用于编辑已存在的 Box
|
|
367
367
|
*/
|
|
368
368
|
editorEnable() {
|
|
369
|
-
return
|
|
369
|
+
return g(this, null, function* () {
|
|
370
370
|
if (!this.position) {
|
|
371
371
|
console.warn("[BoxTag] Cannot enable editor without position. Call startDrawing() first.");
|
|
372
372
|
return;
|
|
@@ -386,20 +386,23 @@ class ie extends C {
|
|
|
386
386
|
syncBoxPositionFromSculpt() {
|
|
387
387
|
if (!this.boxShape)
|
|
388
388
|
return;
|
|
389
|
-
const t = this.boxShape.data, i = t.points.map((
|
|
389
|
+
const t = this.boxShape.data, i = t.points.map((s) => u(s)), o = u(t.heightPoint), e = U(i, o);
|
|
390
390
|
this.position = e, this.hooks.emit("positionChanged", e);
|
|
391
391
|
}
|
|
392
392
|
/**
|
|
393
393
|
* 将 BoxPosition 转换为 Sculpt 需要的数据格式
|
|
394
394
|
*/
|
|
395
395
|
boxPositionToSculptData(t) {
|
|
396
|
-
const i = u(t.start), o = u(t.end), e = new r.Euler().fromArray(t.rotation),
|
|
396
|
+
const i = u(t.start), o = u(t.end), e = new r.Euler().fromArray(t.rotation), s = new r.Vector3((i.x + o.x) / 2, (i.y + o.y) / 2, (i.z + o.z) / 2), l = new r.Vector3(Math.abs(o.x - i.x) / 2, Math.abs(o.y - i.y) / 2, Math.abs(o.z - i.z) / 2), p = new r.Matrix4().makeRotationFromEuler(e), h = [
|
|
397
397
|
new r.Vector3(-0.5, -0.5, -0.5),
|
|
398
398
|
new r.Vector3(0.5, -0.5, -0.5),
|
|
399
399
|
new r.Vector3(0.5, -0.5, 0.5),
|
|
400
400
|
new r.Vector3(-0.5, -0.5, 0.5)
|
|
401
|
-
],
|
|
402
|
-
|
|
401
|
+
], d = new r.Vector3(-0.5, 0.5, -0.5), c = l.clone().multiplyScalar(2), m = this.workUtil.transform, v = h.map((V) => {
|
|
402
|
+
const C = V.clone().multiply(c).applyMatrix4(p).add(s);
|
|
403
|
+
return x(C, m);
|
|
404
|
+
}), w = d.clone().multiply(c).applyMatrix4(p).add(s), k = x(w, m);
|
|
405
|
+
return { bottomPoints: v, heightPoint: k };
|
|
403
406
|
}
|
|
404
407
|
/**
|
|
405
408
|
* @description 点击事件处理
|
|
@@ -453,7 +456,7 @@ class ie extends C {
|
|
|
453
456
|
this.screenPosition = null, this.plugin.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] });
|
|
454
457
|
return;
|
|
455
458
|
}
|
|
456
|
-
const o = new r.Vector3().fromArray(i.start), e = new r.Vector3().fromArray(i.end),
|
|
459
|
+
const o = new r.Vector3().fromArray(i.start), e = new r.Vector3().fromArray(i.end), s = new r.Euler().fromArray(i.rotation), l = [
|
|
457
460
|
new r.Vector3(o.x, o.y, o.z),
|
|
458
461
|
new r.Vector3(e.x, o.y, o.z),
|
|
459
462
|
new r.Vector3(o.x, e.y, o.z),
|
|
@@ -462,29 +465,29 @@ class ie extends C {
|
|
|
462
465
|
new r.Vector3(e.x, o.y, e.z),
|
|
463
466
|
new r.Vector3(o.x, e.y, e.z),
|
|
464
467
|
new r.Vector3(e.x, e.y, e.z)
|
|
465
|
-
],
|
|
466
|
-
|
|
467
|
-
|
|
468
|
+
], p = new r.Vector3().addVectors(o, e).multiplyScalar(0.5), h = this.workUtil.transform;
|
|
469
|
+
l.forEach((m) => {
|
|
470
|
+
m.sub(p).applyEuler(s).add(p), m.copy(x(m, h));
|
|
468
471
|
});
|
|
469
|
-
let
|
|
470
|
-
|
|
471
|
-
|
|
472
|
+
let d = l[0];
|
|
473
|
+
l.forEach((m) => {
|
|
474
|
+
m.x > d.x && (d = m);
|
|
472
475
|
});
|
|
473
|
-
const
|
|
474
|
-
if (
|
|
476
|
+
const c = d.clone().project(this.five.camera);
|
|
477
|
+
if (c.x < -1 || c.x > 1 || c.y < -1 || c.y > 1 || c.z < 0 || c.z > 1)
|
|
475
478
|
this.screenPosition = null;
|
|
476
479
|
else if (this.five.renderer) {
|
|
477
|
-
const
|
|
480
|
+
const m = this.five.renderer.getSize(new r.Vector2());
|
|
478
481
|
this.screenPosition = {
|
|
479
|
-
leftPx: (
|
|
480
|
-
topPx: (-
|
|
482
|
+
leftPx: (c.x + 1) / 2 * m.x,
|
|
483
|
+
topPx: (-c.y + 1) / 2 * m.y,
|
|
481
484
|
scale: 1
|
|
482
485
|
};
|
|
483
486
|
}
|
|
484
487
|
this.plugin.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] });
|
|
485
488
|
}
|
|
486
489
|
get centerPosition() {
|
|
487
|
-
const t =
|
|
490
|
+
const t = A(this.position, this.workUtil.transform), i = F(t, this.matrix);
|
|
488
491
|
let o = i[0];
|
|
489
492
|
return i.forEach((e) => {
|
|
490
493
|
e.x > o.x && (o = e);
|
|
@@ -508,5 +511,5 @@ class ie extends C {
|
|
|
508
511
|
}
|
|
509
512
|
}
|
|
510
513
|
export {
|
|
511
|
-
|
|
514
|
+
se as BoxTag
|
|
512
515
|
};
|
|
@@ -1,36 +1,37 @@
|
|
|
1
|
-
import { addDebugPoints as
|
|
2
|
-
import { noTypecheck as
|
|
3
|
-
import { planeNormal as
|
|
4
|
-
import { applyMatrixToPoints as
|
|
5
|
-
import { checkRange as
|
|
6
|
-
import { normalPositionToPositions as
|
|
7
|
-
import { debounce as
|
|
8
|
-
import { throttle as
|
|
9
|
-
import { binarySearchFirstBig as
|
|
10
|
-
import { formatVideo as
|
|
1
|
+
import { addDebugPoints as p } from "./addDebugPoints.js";
|
|
2
|
+
import { noTypecheck as s } from "./noTypecheck.js";
|
|
3
|
+
import { planeNormal as f } from "./planeNormal.js";
|
|
4
|
+
import { applyMatrixToPoints as l, getBoxCorners as u, getTagCenterPosition as T, getTagPosition as c } from "./tagPosition.js";
|
|
5
|
+
import { checkRange as b } from "./checkRange.js";
|
|
6
|
+
import { normalPositionToPositions as P } from "./normalPositionToPositions.js";
|
|
7
|
+
import { debounce as y, debounceByKey as B } from "./debounce.js";
|
|
8
|
+
import { throttle as C } from "./throttle.js";
|
|
9
|
+
import { binarySearchFirstBig as I, searchFirstValueSmallThanLastValue as S } from "./search.js";
|
|
10
|
+
import { formatVideo as D, getVideoThumbnail as K, getVimeoId as L, getYouTubeId as M, isVimeo as N, isYouTube as R } from "./videoHelper.js";
|
|
11
11
|
import "three";
|
|
12
12
|
import "../../shared-utils/positionToVector3.js";
|
|
13
13
|
import "../../shared-utils/three/centerPoint.js";
|
|
14
14
|
import "./tag/tagCheck.js";
|
|
15
|
+
import "../../shared-utils/five/transformPosition.js";
|
|
15
16
|
export {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
17
|
+
p as addDebugPoints,
|
|
18
|
+
l as applyMatrixToPoints,
|
|
19
|
+
I as binarySearchFirstBig,
|
|
20
|
+
b as checkRange,
|
|
21
|
+
y as debounce,
|
|
22
|
+
B as debounceByKey,
|
|
23
|
+
D as formatVideo,
|
|
24
|
+
u as getBoxCorners,
|
|
25
|
+
T as getTagCenterPosition,
|
|
26
|
+
c as getTagPosition,
|
|
27
|
+
K as getVideoThumbnail,
|
|
28
|
+
L as getVimeoId,
|
|
29
|
+
M as getYouTubeId,
|
|
30
|
+
N as isVimeo,
|
|
31
|
+
R as isYouTube,
|
|
32
|
+
s as noTypecheck,
|
|
33
|
+
P as normalPositionToPositions,
|
|
34
|
+
f as planeNormal,
|
|
35
|
+
S as searchFirstValueSmallThanLastValue,
|
|
36
|
+
C as throttle
|
|
36
37
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { Vector3 } from 'three';
|
|
2
|
+
import { Matrix4 } from 'three';
|
|
2
3
|
import type { TagInstance, BoxPosition } from '../typings';
|
|
3
4
|
/**
|
|
4
5
|
* 计算 BoxPosition 的8个角点
|
|
5
6
|
*/
|
|
6
|
-
export declare function getBoxCorners(boxPosition: BoxPosition): Vector3[];
|
|
7
|
+
export declare function getBoxCorners(boxPosition: BoxPosition, transform: Matrix4): Vector3[];
|
|
7
8
|
/**
|
|
8
9
|
* 应用 matrix 变换到点数组
|
|
9
10
|
*/
|