iflow-engine-base 3.10.7 → 3.10.9
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/bim-engine-sdk.es.js +36 -34
- package/dist/bim-engine-sdk.umd.js +727 -727
- package/dist/chunks/{engine-2d-DsaDpJPQ.js → engine-2d-DVhZzZy6.js} +139 -114
- package/dist/chunks/{engine-3d-XJ7zBlLL.js → engine-3d-LN_LUozy.js} +1800 -1742
- package/dist/chunks/{engine-720-CZj_sSsS.js → engine-720-CxFTL7AO.js} +132 -113
- package/dist/chunks/{engine-gaussian-CX0k_s78.js → engine-gaussian-BTf-NLZ0.js} +617 -579
- package/dist/chunks/{engine-gis-N6XH8qUs.js → engine-gis-BpK8Yk97.js} +10645 -10542
- package/dist/chunks/sdk-assets-RCyRdW2b.js +208 -0
- package/dist/chunks/{sdk-runtime-DTY-QKTD.js → sdk-runtime-CUsuUcES.js} +1557 -1513
- package/dist/chunks/{three-vendor-CAbFcmaK.js → three-vendor-fDCVai2b.js} +2 -1
- package/dist/iflow-engine-base.css +1 -1
- package/dist/index.d.ts +65 -4
- package/dist2d/dwg-preview.es.js +1874 -1762
- package/dist2d/dwg-preview.umd.js +20 -20
- package/distGaussian/gaussian.es.js +9345 -6986
- package/distGaussian/gaussian.umd.js +23 -22
- package/package.json +1 -1
- package/dist/chunks/sdk-assets-1SXx8Tbf.js +0 -84
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
import { C as
|
|
3
|
-
import { E as
|
|
4
|
-
class
|
|
1
|
+
import { n as R, as as S, h as E, aM as b, j as x, t as A, E as k, Q as F, p as I, W as y, a as v, T as f, i as P, K as m, V as p, b as D } from "./three-vendor-fDCVai2b.js";
|
|
2
|
+
import { C as L, W as w, c as T, r as z } from "./sdk-runtime-CUsuUcES.js";
|
|
3
|
+
import { E as _ } from "./engine-2d-DVhZzZy6.js";
|
|
4
|
+
class V {
|
|
5
5
|
scene;
|
|
6
6
|
panoramaSphere = null;
|
|
7
7
|
sphereRadius;
|
|
8
8
|
constructor(e = 500) {
|
|
9
|
-
this.sphereRadius = e, this.scene = new
|
|
9
|
+
this.sphereRadius = e, this.scene = new R(), this.init();
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
12
|
* 初始化场景
|
|
@@ -21,7 +21,7 @@ class _ {
|
|
|
21
21
|
* @returns 球体网格对象
|
|
22
22
|
*/
|
|
23
23
|
createPanoramaSphere(e = 500, t = 64) {
|
|
24
|
-
const n = new
|
|
24
|
+
const n = new S(
|
|
25
25
|
e,
|
|
26
26
|
// 半径
|
|
27
27
|
t,
|
|
@@ -30,14 +30,14 @@ class _ {
|
|
|
30
30
|
// 垂直分段
|
|
31
31
|
);
|
|
32
32
|
n.scale(-1, 1, 1);
|
|
33
|
-
const
|
|
33
|
+
const o = new E({
|
|
34
34
|
map: null,
|
|
35
35
|
// 纹理后续加载
|
|
36
|
-
side:
|
|
36
|
+
side: b,
|
|
37
37
|
// Render inner surface; geometry is flipped via scale(-1,1,1)
|
|
38
38
|
transparent: !0
|
|
39
|
-
}),
|
|
40
|
-
return
|
|
39
|
+
}), a = new x(n, o);
|
|
40
|
+
return a.name = "panorama-sphere", a;
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
43
|
* 更新全景图纹理
|
|
@@ -102,7 +102,7 @@ class _ {
|
|
|
102
102
|
this.scene.clear();
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
|
-
class
|
|
105
|
+
class K {
|
|
106
106
|
camera;
|
|
107
107
|
minFov;
|
|
108
108
|
maxFov;
|
|
@@ -111,8 +111,8 @@ class V {
|
|
|
111
111
|
* 当前相机姿态(球面坐标)
|
|
112
112
|
*/
|
|
113
113
|
currentPose;
|
|
114
|
-
constructor(e, t = 75, n = 30,
|
|
115
|
-
this.container = e, this.minFov = n, this.maxFov =
|
|
114
|
+
constructor(e, t = 75, n = 30, o = 90) {
|
|
115
|
+
this.container = e, this.minFov = n, this.maxFov = o, this.currentPose = {
|
|
116
116
|
theta: 0,
|
|
117
117
|
// 水平角度
|
|
118
118
|
phi: 0
|
|
@@ -123,7 +123,7 @@ class V {
|
|
|
123
123
|
* 创建透视相机
|
|
124
124
|
*/
|
|
125
125
|
createCamera(e) {
|
|
126
|
-
const t = this.container.clientWidth / this.container.clientHeight, n = new
|
|
126
|
+
const t = this.container.clientWidth / this.container.clientHeight, n = new A(e, t, 0.1, 2e3);
|
|
127
127
|
return n.position.set(0, 0, 0), n;
|
|
128
128
|
}
|
|
129
129
|
/**
|
|
@@ -136,8 +136,8 @@ class V {
|
|
|
136
136
|
* 更新相机旋转(基于当前姿态)
|
|
137
137
|
*/
|
|
138
138
|
updateCameraRotation() {
|
|
139
|
-
const { theta: e, phi: t } = this.currentPose, n = new k(t, e, 0, "YXZ"),
|
|
140
|
-
|
|
139
|
+
const { theta: e, phi: t } = this.currentPose, n = new k(t, e, 0, "YXZ"), o = new F();
|
|
140
|
+
o.setFromEuler(n), this.camera.quaternion.copy(o);
|
|
141
141
|
}
|
|
142
142
|
/**
|
|
143
143
|
* 设置 FOV(视野角度)
|
|
@@ -200,7 +200,7 @@ class V {
|
|
|
200
200
|
this.camera = null;
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
|
-
class
|
|
203
|
+
class O {
|
|
204
204
|
renderer;
|
|
205
205
|
container;
|
|
206
206
|
animationId = null;
|
|
@@ -214,18 +214,18 @@ class K {
|
|
|
214
214
|
onBeforeRenderCallback;
|
|
215
215
|
onAfterRenderCallback;
|
|
216
216
|
constructor(e, t = !0) {
|
|
217
|
-
this.container = e, this.renderer = this.createRenderer(t), this.watermark = new
|
|
217
|
+
this.container = e, this.renderer = this.createRenderer(t), this.watermark = new L(I), this.init();
|
|
218
218
|
}
|
|
219
219
|
/**
|
|
220
220
|
* 创建 WebGL 渲染器
|
|
221
221
|
*/
|
|
222
222
|
createRenderer(e) {
|
|
223
|
-
const t = new
|
|
223
|
+
const t = new y({
|
|
224
224
|
antialias: e,
|
|
225
225
|
alpha: !0,
|
|
226
226
|
preserveDrawingBuffer: !1
|
|
227
|
-
}), n = this.container.clientWidth,
|
|
228
|
-
return t.setSize(n,
|
|
227
|
+
}), n = this.container.clientWidth, o = this.container.clientHeight;
|
|
228
|
+
return t.setSize(n, o), t.setPixelRatio(Math.min(window.devicePixelRatio, 2)), this.container.appendChild(t.domElement), t;
|
|
229
229
|
}
|
|
230
230
|
/**
|
|
231
231
|
* 初始化渲染器
|
|
@@ -385,8 +385,8 @@ class H {
|
|
|
385
385
|
*/
|
|
386
386
|
onMouseMove(e) {
|
|
387
387
|
if (!this.isDragging || !this.enableRotate) return;
|
|
388
|
-
const t = e.clientX - this.startX, n = e.clientY - this.startY, { horizontal:
|
|
389
|
-
this.thetaDelta += t *
|
|
388
|
+
const t = e.clientX - this.startX, n = e.clientY - this.startY, { horizontal: o, vertical: a } = this.getRotationFactors();
|
|
389
|
+
this.thetaDelta += t * o * this.rotateSpeed * 0.06, this.phiDelta += n * a * this.rotateSpeed * 0.06, this.startX = e.clientX, this.startY = e.clientY, this.applyRotation();
|
|
390
390
|
}
|
|
391
391
|
/**
|
|
392
392
|
* 鼠标弹起
|
|
@@ -414,18 +414,18 @@ class H {
|
|
|
414
414
|
*/
|
|
415
415
|
onTouchMove(e) {
|
|
416
416
|
if (e.touches.length === 1 && this.isDragging && this.enableRotate) {
|
|
417
|
-
const t = e.touches[0].clientX - this.startX, n = e.touches[0].clientY - this.startY, { horizontal:
|
|
418
|
-
this.thetaDelta -= t *
|
|
417
|
+
const t = e.touches[0].clientX - this.startX, n = e.touches[0].clientY - this.startY, { horizontal: o, vertical: a } = this.getRotationFactors();
|
|
418
|
+
this.thetaDelta -= t * o * this.rotateSpeed, this.phiDelta -= n * a * this.rotateSpeed, this.startX = e.touches[0].clientX, this.startY = e.touches[0].clientY, this.applyRotation();
|
|
419
419
|
} else if (e.touches.length === 2 && this.enableZoom) {
|
|
420
420
|
e.preventDefault(), this.isPinching || (this.isPinching = !0, this.pinchStartDistance = this.getTouchDistance(e.touches), this.pinchStartFov = this.cameraModule.getFov());
|
|
421
421
|
const t = this.getTouchDistance(e.touches);
|
|
422
422
|
if (this.pinchStartDistance && t > 0) {
|
|
423
|
-
const n = this.pinchStartDistance / t,
|
|
423
|
+
const n = this.pinchStartDistance / t, o = v.clamp(
|
|
424
424
|
this.pinchStartFov * n,
|
|
425
425
|
this.minFov,
|
|
426
426
|
this.maxFov
|
|
427
427
|
);
|
|
428
|
-
this.cameraModule.setFov(
|
|
428
|
+
this.cameraModule.setFov(o);
|
|
429
429
|
}
|
|
430
430
|
}
|
|
431
431
|
}
|
|
@@ -543,7 +543,7 @@ class H {
|
|
|
543
543
|
this.domElement.removeEventListener("mousedown", this._onMouseDown), this.domElement.removeEventListener("mousemove", this._onMouseMove), this.domElement.removeEventListener("mouseup", this._onMouseUp), this.domElement.removeEventListener("mouseleave", this._onMouseUp), this.domElement.removeEventListener("wheel", this._onWheel), this.domElement.removeEventListener("touchstart", this._onTouchStart), this.domElement.removeEventListener("touchmove", this._onTouchMove), this.domElement.removeEventListener("touchend", this._onTouchEnd), this.onViewAngleChange = void 0;
|
|
544
544
|
}
|
|
545
545
|
}
|
|
546
|
-
class
|
|
546
|
+
class X {
|
|
547
547
|
controls;
|
|
548
548
|
domElement;
|
|
549
549
|
cameraModule;
|
|
@@ -624,7 +624,7 @@ class O {
|
|
|
624
624
|
this.controls.dispose();
|
|
625
625
|
}
|
|
626
626
|
}
|
|
627
|
-
class
|
|
627
|
+
class Z {
|
|
628
628
|
cache = /* @__PURE__ */ new Map();
|
|
629
629
|
loadingPromises = /* @__PURE__ */ new Map();
|
|
630
630
|
/**
|
|
@@ -637,7 +637,7 @@ class X {
|
|
|
637
637
|
return Promise.resolve(this.cache.get(e));
|
|
638
638
|
if (this.loadingPromises.has(e))
|
|
639
639
|
return this.loadingPromises.get(e);
|
|
640
|
-
const t = new Promise((n,
|
|
640
|
+
const t = new Promise((n, o) => {
|
|
641
641
|
new f().load(
|
|
642
642
|
e,
|
|
643
643
|
(s) => {
|
|
@@ -645,7 +645,7 @@ class X {
|
|
|
645
645
|
},
|
|
646
646
|
void 0,
|
|
647
647
|
(s) => {
|
|
648
|
-
this.loadingPromises.delete(e),
|
|
648
|
+
this.loadingPromises.delete(e), o(s);
|
|
649
649
|
}
|
|
650
650
|
);
|
|
651
651
|
});
|
|
@@ -702,13 +702,13 @@ class X {
|
|
|
702
702
|
this.clear();
|
|
703
703
|
}
|
|
704
704
|
}
|
|
705
|
-
class
|
|
705
|
+
class U {
|
|
706
706
|
textureCache;
|
|
707
707
|
currentUrl = null;
|
|
708
708
|
loadProgress = 0;
|
|
709
709
|
onProgressCallback;
|
|
710
710
|
constructor() {
|
|
711
|
-
this.textureCache = new
|
|
711
|
+
this.textureCache = new Z();
|
|
712
712
|
}
|
|
713
713
|
/**
|
|
714
714
|
* 加载全景图纹理
|
|
@@ -730,22 +730,22 @@ class Z {
|
|
|
730
730
|
loadTextureInternal(e) {
|
|
731
731
|
return new Promise((t, n) => {
|
|
732
732
|
if (this.textureCache.has(e)) {
|
|
733
|
-
const
|
|
734
|
-
if (
|
|
735
|
-
t(
|
|
733
|
+
const a = this.textureCache.get(e);
|
|
734
|
+
if (a) {
|
|
735
|
+
t(a);
|
|
736
736
|
return;
|
|
737
737
|
}
|
|
738
738
|
}
|
|
739
739
|
new f().load(
|
|
740
740
|
e,
|
|
741
|
-
(
|
|
742
|
-
|
|
741
|
+
(a) => {
|
|
742
|
+
a.colorSpace = P, a.minFilter = m, a.magFilter = m, this.textureCache.cache.set(e, a), t(a);
|
|
743
743
|
},
|
|
744
|
-
(
|
|
745
|
-
|
|
744
|
+
(a) => {
|
|
745
|
+
a.total > 0 && (this.loadProgress = a.loaded / a.total * 100, this.onProgressCallback && this.onProgressCallback(this.loadProgress));
|
|
746
746
|
},
|
|
747
|
-
(
|
|
748
|
-
n(
|
|
747
|
+
(a) => {
|
|
748
|
+
n(a);
|
|
749
749
|
}
|
|
750
750
|
);
|
|
751
751
|
});
|
|
@@ -823,8 +823,8 @@ class C {
|
|
|
823
823
|
* @returns 笛卡尔坐标 { x, y, z }
|
|
824
824
|
*/
|
|
825
825
|
static sphericalToCartesian(e) {
|
|
826
|
-
const t = e.radius || 500, { theta: n, phi:
|
|
827
|
-
return { x:
|
|
826
|
+
const t = e.radius || 500, { theta: n, phi: o } = e, a = t * Math.cos(o) * Math.cos(n), s = t * Math.sin(o), h = t * Math.cos(o) * Math.sin(n);
|
|
827
|
+
return { x: a, y: s, z: h };
|
|
828
828
|
}
|
|
829
829
|
/**
|
|
830
830
|
* 笛卡尔坐标转球面坐标
|
|
@@ -834,9 +834,9 @@ class C {
|
|
|
834
834
|
* @returns 球面坐标 { theta, phi, radius }
|
|
835
835
|
*/
|
|
836
836
|
static cartesianToSpherical(e, t, n) {
|
|
837
|
-
const
|
|
837
|
+
const o = Math.sqrt(e * e + t * t + n * n), a = Math.asin(t / o);
|
|
838
838
|
let s = Math.atan2(n, e);
|
|
839
|
-
return s < 0 && (s += 2 * Math.PI), { theta: s, phi:
|
|
839
|
+
return s < 0 && (s += 2 * Math.PI), { theta: s, phi: a, radius: o };
|
|
840
840
|
}
|
|
841
841
|
/**
|
|
842
842
|
* 规范化角度到指定范围
|
|
@@ -846,13 +846,13 @@ class C {
|
|
|
846
846
|
* @returns 规范化后的角度
|
|
847
847
|
*/
|
|
848
848
|
static normalizeAngle(e, t = -Math.PI, n = Math.PI) {
|
|
849
|
-
const
|
|
850
|
-
let
|
|
851
|
-
for (;
|
|
852
|
-
|
|
853
|
-
for (;
|
|
854
|
-
|
|
855
|
-
return
|
|
849
|
+
const o = n - t;
|
|
850
|
+
let a = e;
|
|
851
|
+
for (; a < t; )
|
|
852
|
+
a += o;
|
|
853
|
+
for (; a > n; )
|
|
854
|
+
a -= o;
|
|
855
|
+
return a;
|
|
856
856
|
}
|
|
857
857
|
/**
|
|
858
858
|
* 限制 phi 角度在有效范围内(避免翻转)
|
|
@@ -882,13 +882,13 @@ class C {
|
|
|
882
882
|
* @returns 插值后的球面坐标
|
|
883
883
|
*/
|
|
884
884
|
static lerpSpherical(e, t, n) {
|
|
885
|
-
let
|
|
886
|
-
|
|
887
|
-
const
|
|
888
|
-
return { theta:
|
|
885
|
+
let o = t.theta - e.theta;
|
|
886
|
+
o > Math.PI ? o -= 2 * Math.PI : o < -Math.PI && (o += 2 * Math.PI);
|
|
887
|
+
const a = e.theta + o * n, s = e.phi + (t.phi - e.phi) * n, h = e.radius || 500, l = t.radius || 500, c = h + (l - h) * n;
|
|
888
|
+
return { theta: a, phi: s, radius: c };
|
|
889
889
|
}
|
|
890
890
|
}
|
|
891
|
-
var d = /* @__PURE__ */ ((
|
|
891
|
+
var d = /* @__PURE__ */ ((i) => (i.ICON = "icon", i.TEXT = "text", i.LINK = "link", i))(d || {});
|
|
892
892
|
class W {
|
|
893
893
|
annotations = /* @__PURE__ */ new Map();
|
|
894
894
|
container;
|
|
@@ -900,8 +900,8 @@ class W {
|
|
|
900
900
|
// 事件监听器
|
|
901
901
|
onClickAnnotation;
|
|
902
902
|
onHoverAnnotation;
|
|
903
|
-
constructor(e, t, n,
|
|
904
|
-
this.container = e, this.camera = t, this.renderer = n, this.sphereRadius =
|
|
903
|
+
constructor(e, t, n, o) {
|
|
904
|
+
this.container = e, this.camera = t, this.renderer = n, this.sphereRadius = o, this.worldToScreen = new w(t, n), this.createAnnotationContainer();
|
|
905
905
|
}
|
|
906
906
|
/**
|
|
907
907
|
* 创建标注容器
|
|
@@ -924,15 +924,15 @@ class W {
|
|
|
924
924
|
* @returns 标注 ID
|
|
925
925
|
*/
|
|
926
926
|
addAnnotation(e) {
|
|
927
|
-
const t = this.generateId(), n = this.sphericalToCartesian(e.position),
|
|
927
|
+
const t = this.generateId(), n = this.sphericalToCartesian(e.position), o = this.createAnnotationElement(e, t), a = {
|
|
928
928
|
id: t,
|
|
929
929
|
config: e,
|
|
930
|
-
element:
|
|
930
|
+
element: o,
|
|
931
931
|
worldPosition: n,
|
|
932
932
|
screenPosition: { x: 0, y: 0 },
|
|
933
933
|
visible: !1
|
|
934
934
|
};
|
|
935
|
-
return this.annotationContainer.appendChild(
|
|
935
|
+
return this.annotationContainer.appendChild(o), this.annotations.set(t, a), this.updateAnnotationPosition(a), t;
|
|
936
936
|
}
|
|
937
937
|
/**
|
|
938
938
|
* 批量添加标注
|
|
@@ -972,15 +972,15 @@ class W {
|
|
|
972
972
|
createIconAnnotation(e, t) {
|
|
973
973
|
const n = t.size || { width: 40, height: 40 };
|
|
974
974
|
e.style.width = `${n.width}px`, e.style.height = `${n.height}px`;
|
|
975
|
-
const
|
|
976
|
-
|
|
975
|
+
const o = document.createElement("img");
|
|
976
|
+
o.src = t.iconUrl, o.style.cssText = `
|
|
977
977
|
width: 100%;
|
|
978
978
|
height: 100%;
|
|
979
979
|
object-fit: contain;
|
|
980
980
|
display: block;
|
|
981
|
-
`,
|
|
981
|
+
`, o.onerror = () => {
|
|
982
982
|
console.error(`Failed to load annotation icon: ${t.iconUrl}`);
|
|
983
|
-
}, e.appendChild(
|
|
983
|
+
}, e.appendChild(o), t.tooltip && (e.title = t.tooltip);
|
|
984
984
|
}
|
|
985
985
|
/**
|
|
986
986
|
* 创建文字标注
|
|
@@ -1019,15 +1019,15 @@ class W {
|
|
|
1019
1019
|
}), e.addEventListener("mouseleave", () => {
|
|
1020
1020
|
e.style.backgroundColor = "rgba(59, 130, 246, 0.9)";
|
|
1021
1021
|
}), t.iconUrl) {
|
|
1022
|
-
const
|
|
1023
|
-
|
|
1022
|
+
const a = document.createElement("img");
|
|
1023
|
+
a.src = t.iconUrl, a.style.cssText = `
|
|
1024
1024
|
width: 16px;
|
|
1025
1025
|
height: 16px;
|
|
1026
1026
|
display: block;
|
|
1027
|
-
`, e.appendChild(
|
|
1027
|
+
`, e.appendChild(a);
|
|
1028
1028
|
}
|
|
1029
|
-
const
|
|
1030
|
-
|
|
1029
|
+
const o = document.createElement("span");
|
|
1030
|
+
o.textContent = t.text || t.url, e.appendChild(o), t.tooltip && (e.title = t.tooltip);
|
|
1031
1031
|
}
|
|
1032
1032
|
/**
|
|
1033
1033
|
* 附加标注事件
|
|
@@ -1035,8 +1035,8 @@ class W {
|
|
|
1035
1035
|
attachAnnotationEvents(e, t) {
|
|
1036
1036
|
e.addEventListener("click", (n) => {
|
|
1037
1037
|
n.stopPropagation();
|
|
1038
|
-
const
|
|
1039
|
-
|
|
1038
|
+
const o = this.annotations.get(t);
|
|
1039
|
+
o && this.handleClickAnnotation(o);
|
|
1040
1040
|
}), e.addEventListener("mouseenter", () => {
|
|
1041
1041
|
const n = this.annotations.get(t);
|
|
1042
1042
|
n && this.handleHoverAnnotation(n);
|
|
@@ -1064,8 +1064,8 @@ class W {
|
|
|
1064
1064
|
e.worldPosition.z
|
|
1065
1065
|
), n = this.worldToScreen.worldToScreen(t);
|
|
1066
1066
|
e.screenPosition = { x: n.x, y: n.y };
|
|
1067
|
-
const
|
|
1068
|
-
e.visible =
|
|
1067
|
+
const o = this.isPositionInFront(t), a = this.isPositionInView(n);
|
|
1068
|
+
e.visible = o && a, e.visible ? (e.element.style.display = "block", e.element.style.left = `${n.x}px`, e.element.style.top = `${n.y}px`) : e.element.style.display = "none";
|
|
1069
1069
|
}
|
|
1070
1070
|
/**
|
|
1071
1071
|
* 检查点是否在相机前方
|
|
@@ -1182,10 +1182,10 @@ class Y {
|
|
|
1182
1182
|
* @param callback 要移除的回调函数
|
|
1183
1183
|
*/
|
|
1184
1184
|
off(e, t) {
|
|
1185
|
-
const n = String(e),
|
|
1186
|
-
if (
|
|
1187
|
-
const
|
|
1188
|
-
|
|
1185
|
+
const n = String(e), o = this.listeners.get(n);
|
|
1186
|
+
if (o) {
|
|
1187
|
+
const a = o.indexOf(t);
|
|
1188
|
+
a !== -1 && o.splice(a, 1), o.length === 0 && this.listeners.delete(n);
|
|
1189
1189
|
}
|
|
1190
1190
|
}
|
|
1191
1191
|
/**
|
|
@@ -1194,10 +1194,10 @@ class Y {
|
|
|
1194
1194
|
* @param data 事件数据
|
|
1195
1195
|
*/
|
|
1196
1196
|
trigger(e, t) {
|
|
1197
|
-
const n = String(e),
|
|
1198
|
-
if (
|
|
1199
|
-
const
|
|
1200
|
-
for (const s of
|
|
1197
|
+
const n = String(e), o = this.listeners.get(n);
|
|
1198
|
+
if (o && o.length > 0) {
|
|
1199
|
+
const a = [...o];
|
|
1200
|
+
for (const s of a)
|
|
1201
1201
|
try {
|
|
1202
1202
|
s(t);
|
|
1203
1203
|
} catch (h) {
|
|
@@ -1234,8 +1234,8 @@ class Y {
|
|
|
1234
1234
|
this.clear();
|
|
1235
1235
|
}
|
|
1236
1236
|
}
|
|
1237
|
-
var r = /* @__PURE__ */ ((
|
|
1238
|
-
class
|
|
1237
|
+
var r = /* @__PURE__ */ ((i) => (i.PanoramaLoadStart = "panorama-load-start", i.PanoramaLoadProgress = "panorama-load-progress", i.PanoramaLoaded = "panorama-loaded", i.PanoramaLoadError = "panorama-load-error", i.AnnotationClick = "annotation-click", i.AnnotationHover = "annotation-hover", i.AnnotationAdd = "annotation-add", i.AnnotationRemove = "annotation-remove", i.ViewAngleChanged = "view-angle-changed", i))(r || {});
|
|
1238
|
+
class j {
|
|
1239
1239
|
options;
|
|
1240
1240
|
// 核心模块(使用 definite assignment assertions)
|
|
1241
1241
|
sceneModule;
|
|
@@ -1249,7 +1249,8 @@ class N {
|
|
|
1249
1249
|
worldToScreen;
|
|
1250
1250
|
// 内部状态
|
|
1251
1251
|
isInitialized = !1;
|
|
1252
|
-
version =
|
|
1252
|
+
version = _;
|
|
1253
|
+
localPanoramaResource = null;
|
|
1253
1254
|
constructor(e) {
|
|
1254
1255
|
this.options = e, this.initialize(e);
|
|
1255
1256
|
}
|
|
@@ -1273,19 +1274,19 @@ class N {
|
|
|
1273
1274
|
if (!n)
|
|
1274
1275
|
throw new Error(`Container with id "${t.containerId}" not found`);
|
|
1275
1276
|
try {
|
|
1276
|
-
this.eventModule = new Y(), this.sceneModule = new
|
|
1277
|
+
this.eventModule = new Y(), this.sceneModule = new V(t.sphereRadius), this.cameraModule = new K(
|
|
1277
1278
|
n,
|
|
1278
1279
|
t.fov,
|
|
1279
1280
|
t.minFov,
|
|
1280
1281
|
t.maxFov
|
|
1281
|
-
), this.renderModule = new
|
|
1282
|
+
), this.renderModule = new O(n, !0), this.controlModule = new X(
|
|
1282
1283
|
this.cameraModule,
|
|
1283
1284
|
this.renderModule.getDomElement()
|
|
1284
1285
|
);
|
|
1285
|
-
const
|
|
1286
|
-
|
|
1287
|
-
this.eventModule.trigger(r.ViewAngleChanged, { theta:
|
|
1288
|
-
}), this.panoramaLoader = new
|
|
1286
|
+
const o = this.controlModule.getControls();
|
|
1287
|
+
o.enableZoom = t.enableZoom, o.enableRotate = t.enableRotate, o.setRotateSpeed(t.rotateSpeed), o.setZoomSpeed(t.zoomSpeed), o.setEnableDamping(t.enableDamping), o.setDampingFactor(t.dampingFactor), o.setZoomLimits(t.minFov, t.maxFov), o.setOnViewAngleChange((a, s) => {
|
|
1288
|
+
this.eventModule.trigger(r.ViewAngleChanged, { theta: a, phi: s });
|
|
1289
|
+
}), this.panoramaLoader = new U(), this.worldToScreen = new w(
|
|
1289
1290
|
this.cameraModule.getCamera(),
|
|
1290
1291
|
this.renderModule.getRenderer(),
|
|
1291
1292
|
this.sceneModule.getScene()
|
|
@@ -1294,23 +1295,23 @@ class N {
|
|
|
1294
1295
|
this.cameraModule.getCamera(),
|
|
1295
1296
|
this.renderModule.getRenderer(),
|
|
1296
1297
|
t.sphereRadius
|
|
1297
|
-
), this.annotationManager.setOnClickAnnotation((
|
|
1298
|
+
), this.annotationManager.setOnClickAnnotation((a) => {
|
|
1298
1299
|
this.eventModule.trigger(r.AnnotationClick, {
|
|
1299
|
-
id:
|
|
1300
|
-
config:
|
|
1301
|
-
metadata:
|
|
1300
|
+
id: a.id,
|
|
1301
|
+
config: a.config,
|
|
1302
|
+
metadata: a.config.metadata
|
|
1302
1303
|
});
|
|
1303
|
-
}), this.annotationManager.setOnHoverAnnotation((
|
|
1304
|
+
}), this.annotationManager.setOnHoverAnnotation((a) => {
|
|
1304
1305
|
this.eventModule.trigger(r.AnnotationHover, {
|
|
1305
|
-
annotation:
|
|
1306
|
-
id:
|
|
1307
|
-
config:
|
|
1308
|
-
metadata:
|
|
1306
|
+
annotation: a ? {
|
|
1307
|
+
id: a.id,
|
|
1308
|
+
config: a.config,
|
|
1309
|
+
metadata: a.config.metadata
|
|
1309
1310
|
} : null
|
|
1310
1311
|
});
|
|
1311
1312
|
}), this.setupRenderLoop(), this.isInitialized = !0, console.log("EngineKernel720: Initialized successfully");
|
|
1312
|
-
} catch (
|
|
1313
|
-
throw console.error("EngineKernel720: Initialization failed",
|
|
1313
|
+
} catch (o) {
|
|
1314
|
+
throw console.error("EngineKernel720: Initialization failed", o), o;
|
|
1314
1315
|
}
|
|
1315
1316
|
}
|
|
1316
1317
|
/**
|
|
@@ -1350,11 +1351,26 @@ class N {
|
|
|
1350
1351
|
}), t;
|
|
1351
1352
|
}
|
|
1352
1353
|
}
|
|
1354
|
+
async loadPanoramaFile(e) {
|
|
1355
|
+
this.checkInitialized(), this.revokeLocalPanoramaResource();
|
|
1356
|
+
const t = T(e);
|
|
1357
|
+
this.localPanoramaResource = t;
|
|
1358
|
+
try {
|
|
1359
|
+
await this.loadPanorama(t.url);
|
|
1360
|
+
} catch (n) {
|
|
1361
|
+
throw this.revokeLocalPanoramaResource(), n;
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
async loadModelFile(e) {
|
|
1365
|
+
if (e.length === 0)
|
|
1366
|
+
throw new Error("EngineKernel720: no file selected");
|
|
1367
|
+
await this.loadPanoramaFile(e[0]);
|
|
1368
|
+
}
|
|
1353
1369
|
/**
|
|
1354
1370
|
* 通过 viewToken 解析全景资源地址,再复用现有全景加载逻辑。
|
|
1355
1371
|
*/
|
|
1356
1372
|
async loadPanoramaByViewToken(e) {
|
|
1357
|
-
const t = await
|
|
1373
|
+
const t = await z(
|
|
1358
1374
|
this.options,
|
|
1359
1375
|
e,
|
|
1360
1376
|
"720"
|
|
@@ -1424,11 +1440,11 @@ class N {
|
|
|
1424
1440
|
*/
|
|
1425
1441
|
pickPanoramaPoint(e, t) {
|
|
1426
1442
|
this.checkInitialized();
|
|
1427
|
-
const
|
|
1428
|
-
if (
|
|
1443
|
+
const o = this.renderModule.getRenderer().domElement, a = o.clientWidth, s = o.clientHeight;
|
|
1444
|
+
if (a === 0 || s === 0)
|
|
1429
1445
|
return null;
|
|
1430
|
-
const h = new
|
|
1431
|
-
e /
|
|
1446
|
+
const h = new D(
|
|
1447
|
+
e / a * 2 - 1,
|
|
1432
1448
|
-(t / s * 2 - 1)
|
|
1433
1449
|
), l = this.cameraModule.getCamera(), c = new p(h.x, h.y, 0.5);
|
|
1434
1450
|
c.unproject(l), c.sub(l.position).normalize();
|
|
@@ -1493,8 +1509,8 @@ class N {
|
|
|
1493
1509
|
*/
|
|
1494
1510
|
resize(e, t) {
|
|
1495
1511
|
this.checkInitialized();
|
|
1496
|
-
const n = e ?? this.renderModule.getRenderer().domElement.clientWidth,
|
|
1497
|
-
this.renderModule.resize(n,
|
|
1512
|
+
const n = e ?? this.renderModule.getRenderer().domElement.clientWidth, o = t ?? this.renderModule.getRenderer().domElement.clientHeight;
|
|
1513
|
+
this.renderModule.resize(n, o), this.cameraModule.updateAspectRatio(n, o), console.log("EngineKernel720: Resized to", n, "x", o);
|
|
1498
1514
|
}
|
|
1499
1515
|
/**
|
|
1500
1516
|
* 暂停渲染
|
|
@@ -1529,7 +1545,7 @@ class N {
|
|
|
1529
1545
|
dispose() {
|
|
1530
1546
|
if (this.isInitialized)
|
|
1531
1547
|
try {
|
|
1532
|
-
this.renderModule.pauseRendering(), this.annotationManager.dispose(), this.panoramaLoader.dispose(), this.controlModule.dispose(), this.cameraModule.dispose(), this.renderModule.dispose(), this.sceneModule.dispose(), this.eventModule.dispose(), this.isInitialized = !1, console.log("EngineKernel720: Disposed successfully");
|
|
1548
|
+
this.renderModule.pauseRendering(), this.annotationManager.dispose(), this.panoramaLoader.dispose(), this.controlModule.dispose(), this.cameraModule.dispose(), this.renderModule.dispose(), this.sceneModule.dispose(), this.eventModule.dispose(), this.isInitialized = !1, this.revokeLocalPanoramaResource(), console.log("EngineKernel720: Disposed successfully");
|
|
1533
1549
|
} catch (e) {
|
|
1534
1550
|
console.error("EngineKernel720: Error during dispose", e);
|
|
1535
1551
|
}
|
|
@@ -1541,7 +1557,10 @@ class N {
|
|
|
1541
1557
|
if (!this.isInitialized)
|
|
1542
1558
|
throw new Error("EngineKernel720: Not initialized");
|
|
1543
1559
|
}
|
|
1560
|
+
revokeLocalPanoramaResource() {
|
|
1561
|
+
this.localPanoramaResource?.revoke(), this.localPanoramaResource = null;
|
|
1562
|
+
}
|
|
1544
1563
|
}
|
|
1545
1564
|
export {
|
|
1546
|
-
|
|
1565
|
+
j as EngineKernel720
|
|
1547
1566
|
};
|