iflow-engine-base 3.12.3 → 3.12.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.
@@ -1,5 +1,5 @@
1
1
  import { n as R, at as S, h as E, aN 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, Y as m, V as p, b as D } from "./three-vendor-Bx2tSp_D.js";
2
- import { C as L, W as w, E as T, c as z, r as _ } from "./sdk-runtime-Bw8B0I-e.js";
2
+ import { C as L, W as w, E as T, c as z, r as _ } from "./sdk-runtime-B4l79tmQ.js";
3
3
  class V {
4
4
  scene;
5
5
  panoramaSphere = null;
@@ -1,5 +1,5 @@
1
1
  import { n as Js, C as st, t as Zs, V as v, b as N, O as $s, W as en, M as J, Q as ge, a as tn, f as qt, j as be, B as sn, h as ft, r as it, aO as ze, aP as Pt, aQ as at, X as Bt, aR as ms, aS as yn, aT as xn, aU as In, aV as Tn, U as wn, aW as En, aX as Bn, l as lt, aY as As, aZ as gs, a_ as vn, k as Cs, a$ as Fn, aw as Je, at as Ss, D as Kt, aj as bn, aN as ys, q as Dn, y as We, b0 as qe, aB as xs, s as Mn, b1 as Rn, a9 as Pn, b2 as On, b3 as nn, aD as Is, b4 as kn, ag as Ln, b5 as Ne, b6 as mt, p as Hn } from "./three-vendor-Bx2tSp_D.js";
2
- import { C as Un, c as zn, E as _n, r as Qn } from "./sdk-runtime-Bw8B0I-e.js";
2
+ import { C as Un, c as zn, E as _n, r as Qn } from "./sdk-runtime-B4l79tmQ.js";
3
3
  var De = /* @__PURE__ */ ((m) => (m.LoadStart = "gaussian-load-start", m.LoadProgress = "gaussian-load-progress", m.Loaded = "gaussian-loaded", m.LoadError = "gaussian-load-error", m.SceneRemoved = "gaussian-scene-removed", m.FpsUpdated = "gaussian-fps-updated", m.ViewChanged = "gaussian-view-changed", m))(De || {});
4
4
  class Nn {
5
5
  listeners = /* @__PURE__ */ new Map();
@@ -1,6 +1,6 @@
1
- import { g as xX, J as KN } from "./sdk-vendor-DwLu476l.js";
1
+ import { g as xX, J as KN } from "./sdk-vendor-VZI0bEcg.js";
2
2
  import { b7 as Ii, b8 as TX } from "./three-vendor-Bx2tSp_D.js";
3
- import { l as vX, L as EX, E as CX, d as JN, e as wX, c as $C, a as SX, f as IX, r as DX, h as XC } from "./sdk-runtime-Bw8B0I-e.js";
3
+ import { l as vX, L as EX, E as CX, d as JN, e as wX, c as $C, a as SX, f as IX, r as DX, h as XC } from "./sdk-runtime-B4l79tmQ.js";
4
4
  var QN = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
5
5
  function Fb(e) {
6
6
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
@@ -2,7 +2,7 @@ import { b9 as w } from "./three-vendor-Bx2tSp_D.js";
2
2
  const S = "__BIM_ENGINE_SDK_ASSET_BASE__", b = "__BIM_ENGINE_SDK_ASSET_FILE_MAP__", g = "__BIM_ENGINE_SDK_ASSET_FILE_URLS__", A = "__BIM_ENGINE_SDK_ASSET_FILE_SESSION__", j = "https://unpkg.com/iflow-engine-base@3.9.20/dist/", L = "https://__bim_engine_sdk_asset__/", M = ["assets/", "fonts/", "draco/", "basis/", "texture/", "prompt/"];
3
3
  let _ = null;
4
4
  async function R() {
5
- return _ || (_ = import("./sdk-vendor-DwLu476l.js").then((t) => t.j).then((t) => t.default ?? t)), _;
5
+ return _ || (_ = import("./sdk-vendor-VZI0bEcg.js").then((t) => t.j).then((t) => t.default ?? t)), _;
6
6
  }
7
7
  function a() {
8
8
  return typeof globalThis < "u" ? globalThis : null;
@@ -1,5 +1,5 @@
1
1
  import { R as ve, b as B, V as ce, t as Te, ba as Ce } from "./three-vendor-Bx2tSp_D.js";
2
- import { a as pe, J as ne, p as Ae, l as J } from "./sdk-vendor-DwLu476l.js";
2
+ import { a as pe, J as ne, p as Ae, l as J } from "./sdk-vendor-VZI0bEcg.js";
3
3
  class It {
4
4
  /**
5
5
  * 构造函数
@@ -1056,7 +1056,7 @@ class jt {
1056
1056
  e.stopImmediatePropagation();
1057
1057
  };
1058
1058
  }
1059
- const ot = "3.12.3", st = {
1059
+ const ot = "3.12.4", st = {
1060
1060
  version: ot
1061
1061
  }, V = st.version;
1062
1062
  function se() {
@@ -1,4 +1,4 @@
1
- import { c as ja, g as X0, a as f1 } from "./engine-gis-Cx9rI4U4.js";
1
+ import { c as ja, g as X0, a as f1 } from "./engine-gis-j4GvT41d.js";
2
2
  function d1(t, e) {
3
3
  for (var r = 0; r < e.length; r++) {
4
4
  const i = e[r];
package/dist/index.d.ts CHANGED
@@ -2480,6 +2480,8 @@ declare class EngineKernelV2 {
2480
2480
  modelPlace: ModelPlace;
2481
2481
  /** 基于当前引擎作为基准版本的模型差异比较器。 */
2482
2482
  modelComparison: ModelComparison;
2483
+ /** 管理模型炸开代理对象,并保持炸开后的构件交互身份。 */
2484
+ modelExplode: ModelExplode;
2483
2485
  models: any[];
2484
2486
  reactBoundingClientRect: {
2485
2487
  left: number;
@@ -4022,6 +4024,9 @@ declare class InteractionModule {
4022
4024
  private intersectsRect;
4023
4025
  private getMergedBox;
4024
4026
  private getSceneModel;
4027
+ /** 从射线命中的对象还原真实构件 ID,兼容炸开代理和普通模型对象。 */
4028
+ private getHitModelId;
4029
+ private getEngineNode;
4025
4030
  }
4026
4031
 
4027
4032
  declare class InteractionModule2d {
@@ -5546,6 +5551,9 @@ declare class ModelEdge {
5546
5551
  private indexes;
5547
5552
  private highlightIndexes;
5548
5553
  private highlightEdgeSyncVersion;
5554
+ private explodeHidden;
5555
+ private groupVisibleBeforeExplode;
5556
+ private highlightVisibleBeforeExplode;
5549
5557
  private getModelEntry;
5550
5558
  private getOrCreateItemIndex;
5551
5559
  private getEdgePointsByIndex;
@@ -5556,6 +5564,8 @@ declare class ModelEdge {
5556
5564
  disActive(): void;
5557
5565
  isEnabled(): boolean;
5558
5566
  getOpacity(): number;
5567
+ /** 炸开期间临时隐藏所有边线;退出炸开时恢复进入炸开前的可见状态。 */
5568
+ setExplodeHidden(hidden: boolean): void;
5559
5569
  update(): void;
5560
5570
  private hasPendingModelEdges;
5561
5571
  private loadZipJsonAsync;
@@ -5579,6 +5589,242 @@ declare class ModelEdge {
5579
5589
  showModelEdge(url: string, id: Number): void;
5580
5590
  }
5581
5591
 
5592
+ /**
5593
+ * 模型炸开管理器。
5594
+ *
5595
+ * 设计目标:
5596
+ * 1. 炸开期间不直接修改原始构件顶点,而是创建临时代理网格承载位移。
5597
+ * 2. 代理对象保留原始 url/id,点选、高亮、显隐、框选和双击定位仍按完整构件工作。
5598
+ * 3. 原始渲染对象被临时隐藏或拆分隐藏,避免原位模型与代理模型重复显示。
5599
+ * 4. 炸开期间临时隐藏边线,避免边线与代理模型出现错位。
5600
+ */
5601
+ declare class ModelExplode {
5602
+ private engine;
5603
+ /** 当前是否处于炸开模式;供外部滑块、交互模块判断是否需要走代理逻辑。 */
5604
+ private active;
5605
+ /** 当前炸开倍数。真实代理位移 = record.offsetLocal * factor。 */
5606
+ private factor;
5607
+ /** 本轮炸开创建的所有代理记录,按渲染片段保存。 */
5608
+ private records;
5609
+ /** 非空时表示动画仍在推进,EngineKernel 每帧会调用 update。 */
5610
+ private animation;
5611
+ /** 炸开期间被临时隐藏的高亮/透明/自定义颜色运行时对象,reset 时恢复可见性。 */
5612
+ private hiddenRuntimeObjects;
5613
+ /** 炸开代理专用高亮材质,避免复用原高亮对象导致位置不同步。 */
5614
+ private readonly highlightMaterial;
5615
+ /** 炸开代理专用半透明材质,与原模型透明状态保持一致。 */
5616
+ private readonly translucentMaterial;
5617
+ /** 初始化代理材质,并继承当前剖切平面配置。 */
5618
+ constructor(engine: any);
5619
+ /**
5620
+ * 启动炸开模式。
5621
+ *
5622
+ * 流程:
5623
+ * 1. 清理上一轮代理并恢复边线显示状态,保证重复调用不会叠加状态。
5624
+ * 2. 解析目标构件,未指定 targets 时默认对所有已加载模型执行整模型炸开。
5625
+ * 3. 基于目标包围盒计算每个构件的基础世界位移 offsetWorld。
5626
+ * 4. 为普通网格或实例网格创建代理对象,并隐藏对应原始渲染片段。
5627
+ * 5. 同步当前高亮、隐藏、半透明、自定义颜色状态,并在炸开期间隐藏边线。
5628
+ */
5629
+ explode(options?: ModelExplodeOptions): void;
5630
+ /**
5631
+ * 设置炸开系数,常用于外部滑杆实时控制。
5632
+ *
5633
+ * factor 只改变代理 position,不重新创建代理,因此拖动滑块时不会破坏
5634
+ * 构件的交互身份和材质状态。
5635
+ */
5636
+ setFactor(factor: number): void;
5637
+ /**
5638
+ * 每帧推进炸开动画;由 EngineKernel 的主渲染循环调用。
5639
+ * 动画本质上只是在 from/to 之间插值 factor,最终仍复用 setFactor 的统一同步链路。
5640
+ */
5641
+ update(): void;
5642
+ /**
5643
+ * 清理炸开代理并按当前构件状态恢复原始渲染对象。
5644
+ *
5645
+ * reset 不简单地把所有原对象显示出来,而是重新检查隐藏/高亮/半透明/自定义颜色状态,
5646
+ * 避免用户在炸开期间执行显隐或改色后,退出炸开时丢失业务状态。
5647
+ */
5648
+ reset(): void;
5649
+ /** 释放炸开管理器持有的专用材质,通常由 EngineKernel 销毁时调用。 */
5650
+ dispose(): void;
5651
+ /** 返回当前是否处于炸开模式。 */
5652
+ isActive(): boolean;
5653
+ /**
5654
+ * 判断某个构件是否已由炸开代理接管。
5655
+ * 八叉树、拾取和框选逻辑可据此跳过原位对象,避免命中已隐藏但仍存在于场景中的源构件。
5656
+ */
5657
+ hasRecord(url: string, id: any): boolean;
5658
+ /**
5659
+ * 从命中的代理对象还原真实构件 ID,避免 Object3D.name 字符串化造成 nodesMap 查询失败。
5660
+ */
5661
+ getObjectComponentId(object: any): string | number | null;
5662
+ /**
5663
+ * 返回炸开后用于悬浮高亮的代理网格。
5664
+ * 一个构件可能拆成多个代理片段,调用方应把返回数组整体当作一个完整构件处理。
5665
+ */
5666
+ getCatchMeshes(url: string, id: any): THREE.Mesh[];
5667
+ /**
5668
+ * 返回炸开后的构件世界包围盒,供框选、双击定位等交互使用。
5669
+ * 这里以代理对象的实时 matrixWorld 为准,因此滑块拖动和动画过程中也能得到正确位置。
5670
+ */
5671
+ getExplodedWorldBox(url: string, id: any): THREE.Box3 | null;
5672
+ /**
5673
+ * 对炸开代理做独立射线拾取;返回结构与 three.js Raycaster 结果兼容。
5674
+ * 调用方命中代理后,需要再通过 getObjectComponentId 还原真实构件 id。
5675
+ */
5676
+ raycast(raycaster: THREE.Raycaster): THREE.Intersection[];
5677
+ /**
5678
+ * 同步当前高亮、隐藏、半透明和自定义颜色状态到炸开代理。
5679
+ * 该方法在模型工具模块改变状态后调用,保证炸开期间仍支持完整构件交互。
5680
+ */
5681
+ syncVisualState(): void;
5682
+ private resolveTargets;
5683
+ /**
5684
+ * 构建本轮炸开需要的空间上下文。
5685
+ * 这里提前缓存整体包围盒、模型中心和分组包围盒,避免每个构件重复遍历 nodesMap。
5686
+ */
5687
+ private buildExplodeContext;
5688
+ /**
5689
+ * 计算单个构件或分组的基础世界位移。
5690
+ *
5691
+ * radial/type/major 模式按爆炸原点到构件中心的原始向量移动:
5692
+ * newCenter = origin + (center - origin) * (1 + factor),
5693
+ * 因此真正应用到代理上的位移是 (center - origin) * factor。
5694
+ */
5695
+ private computeOffset;
5696
+ /** 获取本模型的爆炸原点;优先使用业务传入的世界坐标 origin。 */
5697
+ private getExplodeCenter;
5698
+ /**
5699
+ * 根据构件索引创建一条炸开记录。
5700
+ * node.indexes 中的每一项对应一个普通合并网格 group 或一个 InstancedMesh 实例。
5701
+ */
5702
+ private createRecord;
5703
+ /** 为普通合并网格中的单个构件片段创建代理网格。 */
5704
+ private createMeshProxy;
5705
+ /**
5706
+ * 为 InstancedMesh 中的单个实例创建代理网格。
5707
+ * 实例矩阵会被烘焙进 geometry,后续炸开只移动代理 position,拾取也按普通 Mesh 处理。
5708
+ */
5709
+ private createInstanceProxy;
5710
+ /** 给代理对象写入稳定交互身份,避免依赖 name 的字符串化 id。 */
5711
+ private assignProxyIdentity;
5712
+ /**
5713
+ * 隐藏源渲染片段,避免与代理对象重复显示。
5714
+ * 普通合并网格通过重建 geometry groups 隐藏局部片段,实例网格通过零缩放矩阵隐藏单个实例。
5715
+ */
5716
+ private hideSource;
5717
+ /**
5718
+ * 恢复源渲染片段。
5719
+ * 如果构件在炸开期间仍处于隐藏、高亮、半透明或自定义颜色状态,实例源对象继续保持隐藏,
5720
+ * 由对应状态对象负责显示,避免 reset 后出现原模型和状态模型叠加。
5721
+ */
5722
+ private restoreSource;
5723
+ /**
5724
+ * 确保普通合并网格已进入可按构件片段控制的拆分状态。
5725
+ * 第一次拆分时保存原始片段状态,后续重复同步不覆盖 sourceState。
5726
+ */
5727
+ private ensureSplitState;
5728
+ /**
5729
+ * 根据每个构件片段的可见性和材质槽位重建 geometry groups。
5730
+ * 连续且材质一致的片段会被合并成一个 group,减少炸开期间状态切换带来的 draw call。
5731
+ */
5732
+ private rebuildSplitModelGroups;
5733
+ /**
5734
+ * 将业务状态映射到代理对象。
5735
+ * 代理对象不能依赖原场景中的高亮/透明临时对象,因为那些对象仍位于原模型位置。
5736
+ */
5737
+ private applyProxyVisualState;
5738
+ /**
5739
+ * 生成代理专用自定义颜色材质。
5740
+ * 颜色和透明度相同的请求复用 record.customMaterial,避免滑块或状态同步时反复创建材质。
5741
+ */
5742
+ private getCustomMaterial;
5743
+ /**
5744
+ * 隐藏原模型位置上的运行时状态对象。
5745
+ * 高亮、半透明和自定义颜色模块通常会创建额外 mesh;炸开时这些 mesh 不会自动跟随代理,
5746
+ * 因此这里临时隐藏它们,并由代理自己承载相同视觉状态。
5747
+ */
5748
+ private hideRuntimeObjectsForExplodedRecords;
5749
+ /** 恢复 hideRuntimeObjectsForExplodedRecords 临时隐藏的运行时对象。 */
5750
+ private restoreRuntimeObjects;
5751
+ /** 从场景中移除代理对象,并释放代理持有的 geometry 和材质资源。 */
5752
+ private removeProxy;
5753
+ /**
5754
+ * 克隆源材质用于代理。
5755
+ * 当前普通构件代理以主材质为准;高亮、半透明和自定义颜色会在 applyProxyVisualState 中覆盖。
5756
+ */
5757
+ private cloneProxyMaterial;
5758
+ /**
5759
+ * 读取构件节点的世界包围盒。
5760
+ * 节点 box 通常是模型局部坐标,返回前统一乘以模型组的 matrixWorld。
5761
+ */
5762
+ private getNodeWorldBox;
5763
+ /** 计算单个模型在世界坐标下的整体包围盒,作为默认爆炸原点的依据。 */
5764
+ private getModelWorldBox;
5765
+ /** 兼容数字 id 和字符串 id 的 nodesMap 查询。 */
5766
+ private getNode;
5767
+ /** 按 url 从引擎模型列表中查找模型条目。 */
5768
+ private getEngineModel;
5769
+ /**
5770
+ * 获取分组 key。
5771
+ * radial/axis 使用构件自身作为分组;level/type/major 使用映射信息让同组构件共享位移方向。
5772
+ */
5773
+ private getGroupKey;
5774
+ /**
5775
+ * 获取 InstancedMesh 单个实例的原始矩阵。
5776
+ * 优先读取加载器缓存的 matrixsClone/matrixs,避免 getMatrixAt 读到已被隐藏流程改写后的零矩阵。
5777
+ */
5778
+ private getInstanceMatrix;
5779
+ /**
5780
+ * 将世界坐标位移转换成某个父节点下的局部位移。
5781
+ * 代理对象挂在源 mesh 的父节点下,直接使用世界位移会在模型组存在变换时产生偏差。
5782
+ */
5783
+ private worldDeltaToLocalDelta;
5784
+ /** 判断构件当前是否处于高亮状态。 */
5785
+ private isHighlighted;
5786
+ /** 判断构件当前是否处于隐藏状态。 */
5787
+ private isHidden;
5788
+ /** 判断构件当前是否处于半透明状态。 */
5789
+ private isTranslucent;
5790
+ /**
5791
+ * reset 时判断实例源对象是否仍应保持隐藏。
5792
+ * 某些状态由独立运行时对象或代理承担显示,如果直接恢复原实例会造成重复显示。
5793
+ */
5794
+ private shouldKeepOriginalInstanceHidden;
5795
+ /** 统一比较构件 id,兼容业务侧传入数字或字符串。 */
5796
+ private isSameId;
5797
+ /** 归一化炸开系数,非法值按 0 处理,负数不允许反向收缩。 */
5798
+ private normalizeFactor;
5799
+ /** 将任意值转为稳定数字,用于 level 模式缺少可靠排序时生成确定性偏移。 */
5800
+ private getStableNumber;
5801
+ }
5802
+
5803
+ export declare type ModelExplodeAxis = 'x' | 'y' | 'z';
5804
+
5805
+ export declare type ModelExplodeMode = 'radial' | 'axis' | 'level' | 'type' | 'major';
5806
+
5807
+ /**
5808
+ * 炸开配置。
5809
+ * factor 表示炸开位移倍数:0 为原位,1 为基础位移,2 为基础位移的两倍。
5810
+ * origin 用世界坐标表达,未传时默认使用模型自身包围盒中心。
5811
+ */
5812
+ export declare type ModelExplodeOptions = {
5813
+ targets?: ModelExplodeTarget[];
5814
+ factor?: number;
5815
+ mode?: ModelExplodeMode;
5816
+ axis?: ModelExplodeAxis;
5817
+ origin?: THREE.Vector3;
5818
+ animate?: boolean;
5819
+ duration?: number;
5820
+ };
5821
+
5822
+ /** 炸开目标。未传 ids 时表示对该 url 下的所有构件执行炸开。 */
5823
+ export declare type ModelExplodeTarget = {
5824
+ url: string;
5825
+ ids?: Array<string | number>;
5826
+ };
5827
+
5582
5828
  /**
5583
5829
  * 通过 window CustomEvent 实现同页面内多个 3D 引擎实例的轻量联动。
5584
5830
  */
@@ -5907,6 +6153,8 @@ declare class ModelToolModule {
5907
6153
  private getModelGuids;
5908
6154
  private restoreSplitModelsOnIdle;
5909
6155
  getSceneModel(index: number): any;
6156
+ /** 炸开模式下,原模型状态变化后需要同步到代理构件,保证交互语义一致。 */
6157
+ private syncExplodeVisualState;
5910
6158
  getModelCenter(models?: any[]): THREE.Vector3 | null;
5911
6159
  updateMaterial(): void;
5912
6160
  private syncHighlightModelEdges;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iflow-engine-base",
3
- "version": "3.12.3",
3
+ "version": "3.12.4",
4
4
  "description": "BIM Engine SDK for Vue2, Vue3, React and HTML",
5
5
  "main": "./dist/bim-engine-sdk.umd.js",
6
6
  "module": "./dist/bim-engine-sdk.es.js",