@realsee/dnalogel 3.78.0-alpha.2 → 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 +408 -398
- 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/controller/Tag/MaskTag.js +26 -22
- package/libs/PanoTagPlugin/controller/index.js +27 -25
- 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
|
@@ -27,7 +27,7 @@ var S = (m, c, e) => new Promise((s, t) => {
|
|
|
27
27
|
r((e = e.apply(m, c)).next());
|
|
28
28
|
});
|
|
29
29
|
import { BaseTag as D } from "./BaseTag.js";
|
|
30
|
-
import * as
|
|
30
|
+
import * as g from "three";
|
|
31
31
|
import { anime as $ } from "../../../vendor/animejs/lib/anime.es.js";
|
|
32
32
|
import { maskVertexShader as z, maskFragmentShaderMulti as G } from "./MaskTag.shaders.js";
|
|
33
33
|
import { transformPosition as L } from "../../../shared-utils/five/transformPosition.js";
|
|
@@ -220,9 +220,9 @@ const h = class extends D {
|
|
|
220
220
|
};
|
|
221
221
|
}
|
|
222
222
|
static createSharedMesh(e, s, t) {
|
|
223
|
-
const r = Math.max(1, Math.ceil(Math.sqrt(0))), l = 1, n = new Float32Array(r * l * 4), a = new
|
|
223
|
+
const r = Math.max(1, Math.ceil(Math.sqrt(0))), l = 1, n = new Float32Array(r * l * 4), a = new g.DataTexture(n, r, l, g.RGBAFormat, g.FloatType);
|
|
224
224
|
a.needsUpdate = !0;
|
|
225
|
-
const d = new
|
|
225
|
+
const d = new g.ShaderMaterial({
|
|
226
226
|
vertexShader: z,
|
|
227
227
|
fragmentShader: G,
|
|
228
228
|
uniforms: {
|
|
@@ -235,9 +235,9 @@ const h = class extends D {
|
|
|
235
235
|
depthWrite: !1,
|
|
236
236
|
depthTest: !1,
|
|
237
237
|
transparent: !0
|
|
238
|
-
}), u = new
|
|
238
|
+
}), u = new g.SphereGeometry(1, 60, 40);
|
|
239
239
|
u.rotateY(-Math.PI / 2), u.scale(-1, 1, 1);
|
|
240
|
-
const p = new
|
|
240
|
+
const p = new g.Mesh(u, d);
|
|
241
241
|
return p.renderOrder = -1e3, p.__maskMesh = !0, {
|
|
242
242
|
mesh: p,
|
|
243
243
|
material: d,
|
|
@@ -290,12 +290,12 @@ const h = class extends D {
|
|
|
290
290
|
const u = i();
|
|
291
291
|
if (!u)
|
|
292
292
|
return;
|
|
293
|
-
const p = Math.floor(d.uv.x * u.width), y = (Math.floor((1 - d.uv.y) * u.height) * u.width + p) * 4,
|
|
293
|
+
const p = Math.floor(d.uv.x * u.width), y = (Math.floor((1 - d.uv.y) * u.height) * u.width + p) * 4, f = [u.data[y], u.data[y + 1], u.data[y + 2]], M = 0.5 / 255;
|
|
294
294
|
for (const [, T] of e.tagsByColorKey) {
|
|
295
295
|
if (!T.enabled || ((I = T.config) == null ? void 0 : I.clickable) === !1)
|
|
296
296
|
continue;
|
|
297
297
|
const [K, P, U] = T.targetColor;
|
|
298
|
-
if (Math.abs(
|
|
298
|
+
if (Math.abs(f[0] / 255 - K / 255) + Math.abs(f[1] / 255 - P / 255) + Math.abs(f[2] / 255 - U / 255) <= M) {
|
|
299
299
|
s.userData.__lastHitTag = T, n.push(d);
|
|
300
300
|
return;
|
|
301
301
|
}
|
|
@@ -307,7 +307,7 @@ const h = class extends D {
|
|
|
307
307
|
* Mask 标签返回向上的法向量(因为是贴在 cube 面上)
|
|
308
308
|
*/
|
|
309
309
|
computeNormal() {
|
|
310
|
-
return new
|
|
310
|
+
return new g.Vector3(0, 1, 0);
|
|
311
311
|
}
|
|
312
312
|
/**
|
|
313
313
|
* 不把共享 mesh 作为 blink 目标,闪烁通过本 tag 的 style opacity 动画实现
|
|
@@ -437,9 +437,9 @@ const h = class extends D {
|
|
|
437
437
|
this.screenPosition = null, this.plugin.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] });
|
|
438
438
|
return;
|
|
439
439
|
}
|
|
440
|
-
const s = new
|
|
440
|
+
const s = new g.Vector3(...this.position).clone().project(this.five.camera);
|
|
441
441
|
if (this.five.renderer) {
|
|
442
|
-
const t = this.five.renderer.getSize(new
|
|
442
|
+
const t = this.five.renderer.getSize(new g.Vector2());
|
|
443
443
|
this.screenPosition = {
|
|
444
444
|
leftPx: (s.x + 1) / 2 * t.x,
|
|
445
445
|
topPx: (-s.y + 1) / 2 * t.y,
|
|
@@ -465,14 +465,18 @@ const h = class extends D {
|
|
|
465
465
|
* 参考 itemMask 实现
|
|
466
466
|
*/
|
|
467
467
|
updateMeshTransform() {
|
|
468
|
-
var
|
|
468
|
+
var r;
|
|
469
469
|
if (!this.maskMesh)
|
|
470
470
|
return;
|
|
471
|
-
const e = (
|
|
471
|
+
const e = (r = this.fiveState) == null ? void 0 : r.panoIndex;
|
|
472
472
|
if (e === void 0)
|
|
473
473
|
return;
|
|
474
474
|
const s = this.workUtil.getObserver(e);
|
|
475
|
-
|
|
475
|
+
if (!s)
|
|
476
|
+
return;
|
|
477
|
+
this.maskMesh.position.copy(L(s.position, this.workUtil.transform)), this.maskMesh.quaternion.copy(s.quaternion);
|
|
478
|
+
const t = new g.Vector3(), o = new g.Quaternion(), i = new g.Vector3();
|
|
479
|
+
this.workUtil.transform.decompose(t, o, i), this.maskMesh.quaternion.multiply(o), this.five.needsRender = !0;
|
|
476
480
|
}
|
|
477
481
|
/**
|
|
478
482
|
* 步骤1:从材质中解析出 styleList
|
|
@@ -482,7 +486,7 @@ const h = class extends D {
|
|
|
482
486
|
parseStyleListFromMaterial(e) {
|
|
483
487
|
const s = e.uniforms, t = s.groupCount.value, o = s.pixelsPerGroup.value, r = s.mergedTexture.value.image.data, l = [];
|
|
484
488
|
for (let n = 0; n < t; n++) {
|
|
485
|
-
const a = n * o, d = a * 4, u = r[d] * 255, p = r[d + 1] * 255, C = r[d + 2] * 255, y = r[d + 3],
|
|
489
|
+
const a = n * o, d = a * 4, u = r[d] * 255, p = r[d + 1] * 255, C = r[d + 2] * 255, y = r[d + 3], f = (a + 1) * 4, M = r[f] * 255, k = r[f + 1] * 255, I = r[f + 2] * 255, T = r[f + 3] * 255, K = (a + 2) * 4, P = r[K];
|
|
486
490
|
l.push({
|
|
487
491
|
color: [Math.round(u), Math.round(p), Math.round(C), y],
|
|
488
492
|
tolerance: Math.round(M),
|
|
@@ -502,8 +506,8 @@ const h = class extends D {
|
|
|
502
506
|
Array.isArray(s) ? t.push(...s) : t.push(s);
|
|
503
507
|
const o = t.length, i = 3, l = o * i, n = 1, a = new Float32Array(l * n * 4);
|
|
504
508
|
t.forEach((p, C) => {
|
|
505
|
-
const y = C * i,
|
|
506
|
-
a[
|
|
509
|
+
const y = C * i, f = y * 4;
|
|
510
|
+
a[f] = p.color[0] / 255, a[f + 1] = p.color[1] / 255, a[f + 2] = p.color[2] / 255, a[f + 3] = p.color[3];
|
|
507
511
|
const M = (y + 1) * 4;
|
|
508
512
|
a[M] = p.tolerance / 255, a[M + 1] = p.highlightColor[0] / 255, a[M + 2] = p.highlightColor[1] / 255, a[M + 3] = p.highlightColor[2] / 255;
|
|
509
513
|
const k = (y + 2) * 4;
|
|
@@ -603,7 +607,7 @@ const h = class extends D {
|
|
|
603
607
|
console.warn("[MaskTag] updateCanvasTexture only works for Canvas-based masks");
|
|
604
608
|
return;
|
|
605
609
|
}
|
|
606
|
-
this.maskTexture instanceof
|
|
610
|
+
this.maskTexture instanceof g.CanvasTexture && (this.maskTexture.needsUpdate = !0, this.five.needsRender = !0, console.log("[MaskTag] Canvas texture updated"));
|
|
607
611
|
}
|
|
608
612
|
/**
|
|
609
613
|
* 清理当前标签:从共享材质中删除本 tag 的样式槽,并更新材质;
|
|
@@ -662,8 +666,8 @@ const h = class extends D {
|
|
|
662
666
|
s.forEach((u, p) => {
|
|
663
667
|
const C = p * o, y = C * 4;
|
|
664
668
|
n[y] = u.color[0] / 255, n[y + 1] = u.color[1] / 255, n[y + 2] = u.color[2] / 255, n[y + 3] = u.color[3];
|
|
665
|
-
const
|
|
666
|
-
n[
|
|
669
|
+
const f = (C + 1) * 4;
|
|
670
|
+
n[f] = u.tolerance / 255, n[f + 1] = u.highlightColor[0] / 255, n[f + 2] = u.highlightColor[1] / 255, n[f + 3] = u.highlightColor[2] / 255;
|
|
667
671
|
const M = (C + 2) * 4;
|
|
668
672
|
n[M] = u.opacity;
|
|
669
673
|
});
|
|
@@ -709,7 +713,7 @@ const h = class extends D {
|
|
|
709
713
|
try {
|
|
710
714
|
let r;
|
|
711
715
|
if (typeof e == "string") {
|
|
712
|
-
const a = new
|
|
716
|
+
const a = new g.TextureLoader();
|
|
713
717
|
r = yield new Promise((d, u) => {
|
|
714
718
|
if (i.signal.aborted) {
|
|
715
719
|
u(new Error("Load aborted"));
|
|
@@ -729,8 +733,8 @@ const h = class extends D {
|
|
|
729
733
|
});
|
|
730
734
|
});
|
|
731
735
|
} else
|
|
732
|
-
r = new
|
|
733
|
-
r.wrapS =
|
|
736
|
+
r = new g.CanvasTexture(e), r.needsUpdate = !0, console.log("[MaskTag] Created texture from canvas, size:", e.width, "x", e.height);
|
|
737
|
+
r.wrapS = g.ClampToEdgeWrapping, r.wrapT = g.ClampToEdgeWrapping, r.minFilter = g.LinearFilter, r.magFilter = g.LinearFilter, r.anisotropy = 4, r instanceof g.CanvasTexture && (r.needsUpdate = !0), h.maskTextureCache.set(s, {
|
|
734
738
|
texture: r,
|
|
735
739
|
refCount: 1,
|
|
736
740
|
abortController: i
|
|
@@ -10,8 +10,8 @@ var b = (l, p, e) => p in l ? w(l, p, { enumerable: !0, configurable: !0, writab
|
|
|
10
10
|
B.call(p, e) && b(l, e, p[e]);
|
|
11
11
|
return l;
|
|
12
12
|
}, C = (l, p) => F(l, _(p));
|
|
13
|
-
var
|
|
14
|
-
var
|
|
13
|
+
var d = (l, p, e) => (b(l, typeof p != "symbol" ? p + "" : p, e), e);
|
|
14
|
+
var m = (l, p, e) => new Promise((t, i) => {
|
|
15
15
|
var o = (s) => {
|
|
16
16
|
try {
|
|
17
17
|
a(e.next(s));
|
|
@@ -339,18 +339,18 @@ class Vs extends $ {
|
|
|
339
339
|
constructor(e, t) {
|
|
340
340
|
super(e);
|
|
341
341
|
/** state */
|
|
342
|
-
|
|
342
|
+
d(this, "state", { enabled: !0, visible: !0 });
|
|
343
343
|
/** debug */
|
|
344
|
-
|
|
345
|
-
|
|
344
|
+
d(this, "debug");
|
|
345
|
+
d(this, "debugUtil", new W(this));
|
|
346
346
|
/** 全局 hover 启用状态,默认 true */
|
|
347
|
-
|
|
347
|
+
d(this, "globalHoverEnabled", !0);
|
|
348
348
|
/** 更改 tag 模型 */
|
|
349
|
-
|
|
349
|
+
d(this, "changeTagModel", (e, t) => m(this, null, function* () {
|
|
350
350
|
var i;
|
|
351
351
|
e.data = v({}, e.data, t), yield (i = e.loadModel) == null ? void 0 : i.call(e);
|
|
352
352
|
}));
|
|
353
|
-
|
|
353
|
+
d(this, "handleFiveModeChange", (e) => {
|
|
354
354
|
const t = () => {
|
|
355
355
|
this.filter2DPointTag.forEach((i) => {
|
|
356
356
|
i.state.visible = !1, i.applyVisible();
|
|
@@ -364,7 +364,7 @@ class Vs extends $ {
|
|
|
364
364
|
};
|
|
365
365
|
this.tags.length < 500 ? t() : this.five.ready().then(() => t());
|
|
366
366
|
});
|
|
367
|
-
|
|
367
|
+
d(this, "handleFiveWantsMoveToPano", () => {
|
|
368
368
|
if (this.tags.length > 500) {
|
|
369
369
|
this.temporaryState.visible = !1, this.addRenderQueue({ type: "TagContainerSvelte", keys: ["temporaryState"] });
|
|
370
370
|
return;
|
|
@@ -373,18 +373,18 @@ class Vs extends $ {
|
|
|
373
373
|
e.temporaryState.visible = !0;
|
|
374
374
|
}), this.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] }), this.tags.forEach((e) => e.applyVisible());
|
|
375
375
|
});
|
|
376
|
-
|
|
376
|
+
d(this, "clickhandler", (e) => {
|
|
377
377
|
e.tag.onClick(e);
|
|
378
378
|
});
|
|
379
|
-
|
|
379
|
+
d(this, "handleFiveCameraUpdate", () => {
|
|
380
380
|
this.filterPointTag.forEach((e) => e.updateScreenPosition());
|
|
381
381
|
});
|
|
382
|
-
|
|
382
|
+
d(this, "handleFiveCameraFovUpdate", () => {
|
|
383
383
|
this.handleFiveCameraUpdate(), this.five.off("render.prepare", this.handleFiveCameraUpdate), this.five.on("render.prepare", this.handleFiveCameraUpdate), setTimeout(() => {
|
|
384
384
|
this.five.off("render.prepare", this.handleFiveCameraUpdate);
|
|
385
385
|
}, 1e3);
|
|
386
386
|
});
|
|
387
|
-
|
|
387
|
+
d(this, "handleFivePanoArrived", () => m(this, null, function* () {
|
|
388
388
|
this.filter2DPointTag.forEach((e) => {
|
|
389
389
|
e.state.visible = !1, e.applyVisible();
|
|
390
390
|
}), this.tagsDo(this.tags, (e) => {
|
|
@@ -407,16 +407,16 @@ class Vs extends $ {
|
|
|
407
407
|
});
|
|
408
408
|
}));
|
|
409
409
|
/** 楼层切换时,需要更新标签可见性 */
|
|
410
|
-
|
|
410
|
+
d(this, "handleFiveModelShownFloorChange", () => {
|
|
411
411
|
this.tagsDo(this.tags, (e) => e.updateVisible());
|
|
412
412
|
});
|
|
413
|
-
|
|
413
|
+
d(this, "onFiveRefined", D(() => {
|
|
414
414
|
A(this.five.getCurrentState().mode) ? this.setUnfoldedByCamera() : this.tags.forEach((e) => e.cache.clear()), this.tagsDo(this.tags, (e) => e.updateVisible());
|
|
415
415
|
}));
|
|
416
|
-
|
|
416
|
+
d(this, "onFiveEveryReady", () => {
|
|
417
417
|
this.setUnfoldedByCamera(), A(this.five.getCurrentState().mode) && this.tagsDo(this.tags, (e) => e.updateVisible());
|
|
418
418
|
});
|
|
419
|
-
|
|
419
|
+
d(this, "render", () => {
|
|
420
420
|
this.renderQueue.forEach((e, t) => {
|
|
421
421
|
const { keys: i } = e;
|
|
422
422
|
if (t === "TagContainerSvelte") {
|
|
@@ -472,7 +472,7 @@ class Vs extends $ {
|
|
|
472
472
|
* @description 加载数据
|
|
473
473
|
*/
|
|
474
474
|
load(e) {
|
|
475
|
-
return
|
|
475
|
+
return m(this, null, function* () {
|
|
476
476
|
var o, n;
|
|
477
477
|
c.clearSharedMeshRegistry(), this.clearTags();
|
|
478
478
|
try {
|
|
@@ -508,7 +508,7 @@ class Vs extends $ {
|
|
|
508
508
|
* @param options.updateMaskUrl 是否更新 mask。若为 true 且该 panoIndex 已有 Mask 标签,仅更新其 maskUrl(不变 color、style),并添加新标签
|
|
509
509
|
*/
|
|
510
510
|
addTag(e, t) {
|
|
511
|
-
return
|
|
511
|
+
return m(this, null, function* () {
|
|
512
512
|
var a, s;
|
|
513
513
|
const o = (Array.isArray(e) ? e : [e]).filter((r) => r.stickType === "3DBox" || r.stickType === "Mask" || r.position);
|
|
514
514
|
if (t != null && t.updateMaskUrl && o.length === 1 && o[0].stickType === "Mask") {
|
|
@@ -522,7 +522,7 @@ class Vs extends $ {
|
|
|
522
522
|
const h = N(r);
|
|
523
523
|
return h === "2DPoint" || h === "3DPoint" ? new q(this, r) : h === "Model" ? new J(this, r) : h === "Plane" ? new Z(this, r) : h === "3DBox" ? new Y(this, r) : h === "Polygon" ? new K(this, r) : h === "Mask" ? new c(this, r) : null;
|
|
524
524
|
});
|
|
525
|
-
return n.forEach((r) => x(r)), this.tags.push(...n), this.tagsLengthWillUpdate = !0, j(this.five).then(() =>
|
|
525
|
+
return n.forEach((r) => x(r)), this.tags.push(...n), this.tagsLengthWillUpdate = !0, j(this.five).then(() => m(this, null, function* () {
|
|
526
526
|
var r, h;
|
|
527
527
|
this.store.eventListenerDisposer && ((h = (r = this.store).eventListenerDisposer) == null || h.call(r)), this.state.enabled && this.handleEnable(), this.addResizeListener(), this.clearUnusedPanelTag(), this.tagsDo(n, (f) => {
|
|
528
528
|
this.tags.includes(f) && (f.updateVisible(), f.updateZIndex());
|
|
@@ -559,7 +559,7 @@ class Vs extends $ {
|
|
|
559
559
|
});
|
|
560
560
|
}
|
|
561
561
|
show(e) {
|
|
562
|
-
return
|
|
562
|
+
return m(this, null, function* () {
|
|
563
563
|
if (this.checkDisposed())
|
|
564
564
|
return;
|
|
565
565
|
const { userAction: t = !0 } = e != null ? e : {};
|
|
@@ -567,7 +567,7 @@ class Vs extends $ {
|
|
|
567
567
|
});
|
|
568
568
|
}
|
|
569
569
|
hide(e) {
|
|
570
|
-
return
|
|
570
|
+
return m(this, null, function* () {
|
|
571
571
|
if (this.checkDisposed())
|
|
572
572
|
return;
|
|
573
573
|
const { userAction: t = !0 } = e != null ? e : {};
|
|
@@ -611,7 +611,7 @@ class Vs extends $ {
|
|
|
611
611
|
* @param {Partial<anime.AnimeParams>} animeConfig
|
|
612
612
|
*/
|
|
613
613
|
blinkTagById(e, t) {
|
|
614
|
-
return
|
|
614
|
+
return m(this, null, function* () {
|
|
615
615
|
var i;
|
|
616
616
|
return (i = this.getTagById(e)) == null ? void 0 : i.blink(t);
|
|
617
617
|
});
|
|
@@ -673,7 +673,9 @@ class Vs extends $ {
|
|
|
673
673
|
if (t.stickType && t.stickType !== o.stickType) {
|
|
674
674
|
console.log(`[PanoTagPlugin] stickType changed from ${o.stickType} to ${t.stickType}, recreating tag`);
|
|
675
675
|
const n = g({}, o);
|
|
676
|
-
this.destroyTagById(e), this.
|
|
676
|
+
this.destroyTagById(e), this.five.ready().then(() => {
|
|
677
|
+
this.addTag(g(g({}, n), t));
|
|
678
|
+
});
|
|
677
679
|
return;
|
|
678
680
|
}
|
|
679
681
|
o.set(t), o instanceof c && o.updateMaskStyle(), o.updateVisible(), this.clearUnusedPanelTag(), o.hooks.emit("dataChanged", o.data);
|
|
@@ -744,7 +746,7 @@ class Vs extends $ {
|
|
|
744
746
|
* @description 设置 unfolded
|
|
745
747
|
*/
|
|
746
748
|
setUnfolded() {
|
|
747
|
-
return
|
|
749
|
+
return m(this, null, function* () {
|
|
748
750
|
return new Promise((e) => {
|
|
749
751
|
setTimeout(() => {
|
|
750
752
|
this.setUnfoldedByCamera(), e();
|
|
@@ -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
|
*/
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { Euler as y, Vector3 as t, Matrix4 as
|
|
2
|
-
import { centerPoint as
|
|
3
|
-
import { is3DBoxTag as
|
|
4
|
-
import { anyPositionToVector3 as
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { Euler as y, Vector3 as t, Matrix4 as p } from "three";
|
|
2
|
+
import { centerPoint as x } from "../../shared-utils/three/centerPoint.js";
|
|
3
|
+
import { is3DBoxTag as M, isPolygonTag as d, isMediaModelTag as P, isMaskTag as T } from "./tag/tagCheck.js";
|
|
4
|
+
import { anyPositionToVector3 as a, vector3Position as z } from "../../shared-utils/positionToVector3.js";
|
|
5
|
+
import { transformPosition as A } from "../../shared-utils/five/transformPosition.js";
|
|
6
|
+
function h(o, i) {
|
|
7
|
+
const n = a(o.start), r = a(o.end), e = new y().fromArray(o.rotation), s = A(new t((n.x + r.x) / 2, (n.y + r.y) / 2, (n.z + r.z) / 2), i), m = new t(Math.abs(r.x - n.x) / 2, Math.abs(r.y - n.y) / 2, Math.abs(r.z - n.z) / 2), u = new p().makeRotationFromEuler(e), f = [
|
|
7
8
|
// 底面4个点 (y = -0.5)
|
|
8
9
|
new t(-0.5, -0.5, -0.5),
|
|
9
10
|
new t(0.5, -0.5, -0.5),
|
|
@@ -14,40 +15,41 @@ function z(o) {
|
|
|
14
15
|
new t(0.5, 0.5, -0.5),
|
|
15
16
|
new t(0.5, 0.5, 0.5),
|
|
16
17
|
new t(-0.5, 0.5, 0.5)
|
|
17
|
-
],
|
|
18
|
-
return
|
|
18
|
+
], l = m.clone().multiplyScalar(2);
|
|
19
|
+
return f.map((w) => w.clone().multiply(l).applyMatrix4(u).add(s));
|
|
19
20
|
}
|
|
20
|
-
function
|
|
21
|
-
if (!
|
|
21
|
+
function c(o, i) {
|
|
22
|
+
if (!i)
|
|
22
23
|
return o;
|
|
23
|
-
const
|
|
24
|
-
return o.map((
|
|
24
|
+
const n = new p().fromArray(i);
|
|
25
|
+
return o.map((r) => r.clone().applyMatrix4(n));
|
|
25
26
|
}
|
|
26
|
-
function
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
const r = z(o.position);
|
|
30
|
-
return s(r, o.matrix);
|
|
31
|
-
}
|
|
27
|
+
function k(o) {
|
|
28
|
+
const i = (() => {
|
|
29
|
+
var n, r;
|
|
32
30
|
if (M(o) && o.position) {
|
|
33
|
-
const
|
|
34
|
-
return
|
|
31
|
+
const e = h(o.position, (r = (n = o.plugin) == null ? void 0 : n.workUtil) == null ? void 0 : r.transform);
|
|
32
|
+
return c(e, o.matrix);
|
|
33
|
+
}
|
|
34
|
+
if (d(o) && o.position) {
|
|
35
|
+
const e = o.position.map((s) => a(s));
|
|
36
|
+
return c(e, o.matrix);
|
|
35
37
|
}
|
|
36
|
-
if (
|
|
37
|
-
const
|
|
38
|
-
return
|
|
38
|
+
if (P(o) && o.matrix) {
|
|
39
|
+
const e = o.data.mediaPosition.map((s) => a(s));
|
|
40
|
+
return c(e, o.matrix);
|
|
39
41
|
}
|
|
40
|
-
return T(o) ? o.position && Array.isArray(o.position) ?
|
|
42
|
+
return T(o) ? o.position && Array.isArray(o.position) ? a(o.position) : (console.warn("[getTagPosition] Mask tag without position, tag id:", o.id), new t(0, 0, 0)) : o.position;
|
|
41
43
|
})();
|
|
42
|
-
return
|
|
44
|
+
return z(i);
|
|
43
45
|
}
|
|
44
|
-
function
|
|
45
|
-
const
|
|
46
|
-
return
|
|
46
|
+
function v(o) {
|
|
47
|
+
const i = k(o);
|
|
48
|
+
return x(...Array.isArray(i) ? i : [i]);
|
|
47
49
|
}
|
|
48
50
|
export {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
c as applyMatrixToPoints,
|
|
52
|
+
h as getBoxCorners,
|
|
53
|
+
v as getTagCenterPosition,
|
|
54
|
+
k as getTagPosition
|
|
53
55
|
};
|
package/libs/base/BasePlugin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function A() {
|
|
2
2
|
console.debug(
|
|
3
|
-
"%c %c@realsee/dnalogel %cv3.78.0-alpha.
|
|
3
|
+
"%c %c@realsee/dnalogel %cv3.78.0-alpha.4",
|
|
4
4
|
[
|
|
5
5
|
"background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAMCAMAAACHgmeRAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAABLFBMVEUAAAAapPoap/oaqvkbrfkbr/gZnfwZoPsaqfnD4v/E4/8Ylv0clPm93/+/4P/B4f8Yj/683/8Wif+33P8Uhv+x2f8ShP+s1v8Pgf+n0/8Nf/+h0f8Lff8Lff8Nf/9dl/+czv8KfP8KfP+Lxf+Uyv+Xy/+Hwv+Jw/+Mxf+Oxv+RyP8aovsapfoap/oZmfwZm/wZnvsYnPsYkf4YlP0NePsDYfgYcfi43f+63v8Xiv8Xjf4EWfwCV/sWZ/qz2v+02/8Vh/8WiP8EUf8CTf4WXv2u1/+v2P8Thf8Thv8ETf8CR/8VV/+o1f+q1f8Qgv8Rg/8DSv8BRf8UVP+j0v+k0v8OgP8Pgf8DR/8DQv9Nhf+dzv+fz/+Kv/+Vyv+Xy/+azf+Oxv+Qx/+SyP////8MUhLdAAAAK3RSTlMACEWQ2bd98uQECPXxqO7c+Pb49vj2+Pb49vj23Oul8fMHA+TwerXXjEIG2P+bHgAAAAFiS0dEY1y+LaoAAAB+SURBVAjXY2BgZGJmYWVgYGBgY9fW0eVg4ORi4NbTNzDk4eXjZxAwMjYxNTO3EGQQsrSytrG1sxdmEHFwdHJ2cXUTZRBz9/D08vbxFWeQ8PMPCAwKDpFkkAoNC4+IjIqWZpCRlZOPiY2LV2BQVGJQTkhMUlEFWaOmrqGpxQAAyg0S9Dq+VPYAAAAASUVORK5CYII=')",
|
|
6
6
|
"background-repeat: no-repeat",
|