iflow-engine-base 3.9.18 → 3.9.21

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.
@@ -1,6 +1,6 @@
1
- import { n as S, am as R, h as A, aA as x, j as b, s as E, E as F, Q as k, W as I, a as f, T as v, i as P, J as m, V as p, b as D } from "./three-vendor-Dbcwwhki.js";
2
- import { W as C } from "./sdk-runtime-gCd6dMmU.js";
3
- import { E as y } from "./engine-2d-Di06Ry30.js";
1
+ import { n as S, am as R, h as A, aA as x, j as b, s as E, E as F, Q as k, W as I, a as v, T as f, i as P, J as m, V as p, b as D } from "./three-vendor-Dbcwwhki.js";
2
+ import { W as w, r as y } from "./sdk-runtime-cY1Wn7o-.js";
3
+ import { E as T } from "./engine-2d-DAiE1uAy.js";
4
4
  class L {
5
5
  scene;
6
6
  panoramaSphere = null;
@@ -102,7 +102,7 @@ class L {
102
102
  this.scene.clear();
103
103
  }
104
104
  }
105
- class T {
105
+ class z {
106
106
  camera;
107
107
  minFov;
108
108
  maxFov;
@@ -200,7 +200,7 @@ class T {
200
200
  this.camera = null;
201
201
  }
202
202
  }
203
- class z {
203
+ class _ {
204
204
  renderer;
205
205
  container;
206
206
  animationId = null;
@@ -328,7 +328,7 @@ class z {
328
328
  this.pauseRendering(), this.container.contains(this.renderer.domElement) && this.container.removeChild(this.renderer.domElement), this.renderer.dispose(), this.renderer.forceContextLoss(), this.onBeforeRenderCallback = void 0, this.onAfterRenderCallback = void 0;
329
329
  }
330
330
  }
331
- class _ {
331
+ class V {
332
332
  camera;
333
333
  domElement;
334
334
  cameraModule;
@@ -419,7 +419,7 @@ class _ {
419
419
  e.preventDefault(), this.isPinching || (this.isPinching = !0, this.pinchStartDistance = this.getTouchDistance(e.touches), this.pinchStartFov = this.cameraModule.getFov());
420
420
  const t = this.getTouchDistance(e.touches);
421
421
  if (this.pinchStartDistance && t > 0) {
422
- const n = this.pinchStartDistance / t, i = f.clamp(
422
+ const n = this.pinchStartDistance / t, i = v.clamp(
423
423
  this.pinchStartFov * n,
424
424
  this.minFov,
425
425
  this.maxFov
@@ -457,7 +457,7 @@ class _ {
457
457
  * 统一缩放逻辑
458
458
  */
459
459
  applyZoom(e) {
460
- const t = this.cameraModule.getFov(), n = f.clamp(
460
+ const t = this.cameraModule.getFov(), n = v.clamp(
461
461
  t + e,
462
462
  this.minFov,
463
463
  this.maxFov
@@ -542,12 +542,12 @@ class _ {
542
542
  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;
543
543
  }
544
544
  }
545
- class V {
545
+ class K {
546
546
  controls;
547
547
  domElement;
548
548
  cameraModule;
549
549
  constructor(e, t) {
550
- this.cameraModule = e, this.domElement = t, this.controls = new _(e, t);
550
+ this.cameraModule = e, this.domElement = t, this.controls = new V(e, t);
551
551
  }
552
552
  /**
553
553
  * 初始化控制模块
@@ -637,7 +637,7 @@ class O {
637
637
  if (this.loadingPromises.has(e))
638
638
  return this.loadingPromises.get(e);
639
639
  const t = new Promise((n, i) => {
640
- new v().load(
640
+ new f().load(
641
641
  e,
642
642
  (s) => {
643
643
  s.colorSpace = P, s.minFilter = m, s.magFilter = m, this.cache.set(e, s), this.loadingPromises.delete(e), n(s);
@@ -735,7 +735,7 @@ class H {
735
735
  return;
736
736
  }
737
737
  }
738
- new v().load(
738
+ new f().load(
739
739
  e,
740
740
  (o) => {
741
741
  o.colorSpace = P, o.minFilter = m, o.magFilter = m, this.textureCache.cache.set(e, o), t(o);
@@ -815,7 +815,7 @@ class H {
815
815
  this.textureCache.dispose(), this.onProgressCallback = void 0, this.currentUrl = null;
816
816
  }
817
817
  }
818
- class w {
818
+ class C {
819
819
  /**
820
820
  * 球面坐标转笛卡尔坐标
821
821
  * @param position 球面坐标 { theta, phi, radius }
@@ -888,7 +888,7 @@ class w {
888
888
  }
889
889
  }
890
890
  var d = /* @__PURE__ */ ((a) => (a.ICON = "icon", a.TEXT = "text", a.LINK = "link", a))(d || {});
891
- class K {
891
+ class X {
892
892
  annotations = /* @__PURE__ */ new Map();
893
893
  container;
894
894
  annotationContainer;
@@ -900,7 +900,7 @@ class K {
900
900
  onClickAnnotation;
901
901
  onHoverAnnotation;
902
902
  constructor(e, t, n, i) {
903
- this.container = e, this.camera = t, this.renderer = n, this.sphereRadius = i, this.worldToScreen = new C(t, n), this.createAnnotationContainer();
903
+ this.container = e, this.camera = t, this.renderer = n, this.sphereRadius = i, this.worldToScreen = new w(t, n), this.createAnnotationContainer();
904
904
  }
905
905
  /**
906
906
  * 创建标注容器
@@ -1048,7 +1048,7 @@ class K {
1048
1048
  */
1049
1049
  sphericalToCartesian(e) {
1050
1050
  const t = e.radius ?? this.sphereRadius;
1051
- return w.sphericalToCartesian({
1051
+ return C.sphericalToCartesian({
1052
1052
  ...e,
1053
1053
  radius: t
1054
1054
  });
@@ -1164,7 +1164,7 @@ class K {
1164
1164
  return `annotation-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
1165
1165
  }
1166
1166
  }
1167
- class X {
1167
+ class Z {
1168
1168
  listeners = /* @__PURE__ */ new Map();
1169
1169
  /**
1170
1170
  * 订阅事件
@@ -1234,7 +1234,8 @@ class X {
1234
1234
  }
1235
1235
  }
1236
1236
  var r = /* @__PURE__ */ ((a) => (a.PanoramaLoadStart = "panorama-load-start", a.PanoramaLoadProgress = "panorama-load-progress", a.PanoramaLoaded = "panorama-loaded", a.PanoramaLoadError = "panorama-load-error", a.AnnotationClick = "annotation-click", a.AnnotationHover = "annotation-hover", a.AnnotationAdd = "annotation-add", a.AnnotationRemove = "annotation-remove", a.ViewAngleChanged = "view-angle-changed", a))(r || {});
1237
- class W {
1237
+ class $ {
1238
+ options;
1238
1239
  // 核心模块(使用 definite assignment assertions)
1239
1240
  sceneModule;
1240
1241
  cameraModule;
@@ -1247,9 +1248,9 @@ class W {
1247
1248
  worldToScreen;
1248
1249
  // 内部状态
1249
1250
  isInitialized = !1;
1250
- version = y;
1251
+ version = T;
1251
1252
  constructor(e) {
1252
- this.initialize(e);
1253
+ this.options = e, this.initialize(e);
1253
1254
  }
1254
1255
  /**
1255
1256
  * 初始化引擎
@@ -1271,23 +1272,23 @@ class W {
1271
1272
  if (!n)
1272
1273
  throw new Error(`Container with id "${t.containerId}" not found`);
1273
1274
  try {
1274
- this.eventModule = new X(), this.sceneModule = new L(t.sphereRadius), this.cameraModule = new T(
1275
+ this.eventModule = new Z(), this.sceneModule = new L(t.sphereRadius), this.cameraModule = new z(
1275
1276
  n,
1276
1277
  t.fov,
1277
1278
  t.minFov,
1278
1279
  t.maxFov
1279
- ), this.renderModule = new z(n, !0), this.controlModule = new V(
1280
+ ), this.renderModule = new _(n, !0), this.controlModule = new K(
1280
1281
  this.cameraModule,
1281
1282
  this.renderModule.getDomElement()
1282
1283
  );
1283
1284
  const i = this.controlModule.getControls();
1284
1285
  i.enableZoom = t.enableZoom, i.enableRotate = t.enableRotate, i.setRotateSpeed(t.rotateSpeed), i.setZoomSpeed(t.zoomSpeed), i.setEnableDamping(t.enableDamping), i.setDampingFactor(t.dampingFactor), i.setZoomLimits(t.minFov, t.maxFov), i.setOnViewAngleChange((o, s) => {
1285
1286
  this.eventModule.trigger(r.ViewAngleChanged, { theta: o, phi: s });
1286
- }), this.panoramaLoader = new H(), this.worldToScreen = new C(
1287
+ }), this.panoramaLoader = new H(), this.worldToScreen = new w(
1287
1288
  this.cameraModule.getCamera(),
1288
1289
  this.renderModule.getRenderer(),
1289
1290
  this.sceneModule.getScene()
1290
- ), this.annotationManager = new K(
1291
+ ), this.annotationManager = new X(
1291
1292
  n,
1292
1293
  this.cameraModule.getCamera(),
1293
1294
  this.renderModule.getRenderer(),
@@ -1348,6 +1349,19 @@ class W {
1348
1349
  }), t;
1349
1350
  }
1350
1351
  }
1352
+ /**
1353
+ * 通过 viewToken 解析全景资源地址,再复用现有全景加载逻辑。
1354
+ */
1355
+ async loadPanoramaByViewToken(e) {
1356
+ const t = await y(
1357
+ this.options,
1358
+ e,
1359
+ "720"
1360
+ );
1361
+ if (t.assetCategory === "composite_model" && t.urls.length > 1)
1362
+ throw new Error("EngineKernel720: composite_model viewToken is not supported");
1363
+ await this.loadPanorama(t.url);
1364
+ }
1351
1365
  /**
1352
1366
  * 预加载多个全景图
1353
1367
  * @param urls 全景图 URL 数组
@@ -1417,7 +1431,7 @@ class W {
1417
1431
  -(t / s * 2 - 1)
1418
1432
  ), l = this.cameraModule.getCamera(), c = new p(h.x, h.y, 0.5);
1419
1433
  c.unproject(l), c.sub(l.position).normalize();
1420
- const g = this.sceneModule.getSphereRadius(), u = l.position.clone().add(c.multiplyScalar(g)), M = w.cartesianToSpherical(u.x, u.y, u.z);
1434
+ const g = this.sceneModule.getSphereRadius(), u = l.position.clone().add(c.multiplyScalar(g)), M = C.cartesianToSpherical(u.x, u.y, u.z);
1421
1435
  return {
1422
1436
  theta: M.theta,
1423
1437
  phi: M.phi,
@@ -1528,5 +1542,5 @@ class W {
1528
1542
  }
1529
1543
  }
1530
1544
  export {
1531
- W as EngineKernel720
1545
+ $ as EngineKernel720
1532
1546
  };