iflow-engine 1.3.3 → 1.4.0

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.
@@ -77,6 +77,12 @@ export declare class BimButtonGroup implements IBimComponent {
77
77
  private closeDropdown;
78
78
  private updateButtonState;
79
79
  private getIcon;
80
+ /**
81
+ * 更新指定按钮的图标
82
+ * @param id 按钮 ID
83
+ * @param icon 新的 SVG 图标字符串
84
+ */
85
+ updateButtonIcon(id: string, icon: string): void;
80
86
  updateButtonVisibility(id: string, visible: boolean): void;
81
87
  setShowLabel(show: boolean): void;
82
88
  private updateLabelsVisibility;
@@ -0,0 +1,3 @@
1
+ import { ButtonConfig } from '../../../index.type';
2
+ import { ManagerRegistry } from '../../../../../core/manager-registry';
3
+ export declare const createCameraSwitchButton: (registry: ManagerRegistry) => ButtonConfig;
@@ -261,6 +261,16 @@ export declare class Engine implements IBimComponent {
261
261
  * @remarks 对接底层 `engine.clipping.reverse()`
262
262
  */
263
263
  reverseSection(): void;
264
+ /**
265
+ * 切换相机类型(透视/正交)
266
+ * @remarks 底层调用 cameraModule.switchCurrentCamera(),保留当前相机位置
267
+ */
268
+ switchCamera(): void;
269
+ /**
270
+ * 获取当前相机类型
271
+ * @returns 'perspective' | 'orthographic'
272
+ */
273
+ getCameraType(): 'perspective' | 'orthographic';
264
274
  /**
265
275
  * 获取当前渲染模式
266
276
  * @returns 'simple' | 'balance' | 'advanced'
@@ -24,7 +24,8 @@ const Mg = {
24
24
  section: "剖切",
25
25
  sectionPlane: "拾取面剖切",
26
26
  sectionAxis: "轴向剖切",
27
- sectionBox: "剖切盒"
27
+ sectionBox: "剖切盒",
28
+ cameraSwitch: "相机切换"
28
29
  },
29
30
  dialog: {
30
31
  testTitle: "测试弹窗",
@@ -260,7 +261,8 @@ const Mg = {
260
261
  section: "Section",
261
262
  sectionPlane: "Plane Section",
262
263
  sectionAxis: "Axis Section",
263
- sectionBox: "Section Box"
264
+ sectionBox: "Section Box",
265
+ cameraSwitch: "Camera"
264
266
  },
265
267
  dialog: {
266
268
  testTitle: "Test Dialog",
@@ -1090,6 +1092,19 @@ class kd {
1090
1092
  getIcon(e) {
1091
1093
  return e || this.DEFAULT_ICON;
1092
1094
  }
1095
+ /**
1096
+ * 更新指定按钮的图标
1097
+ * @param id 按钮 ID
1098
+ * @param icon 新的 SVG 图标字符串
1099
+ */
1100
+ updateButtonIcon(e, t) {
1101
+ const n = this.btnRefs.get(e);
1102
+ if (!n) return;
1103
+ const i = n.querySelector(".opt-btn-icon");
1104
+ i && (i.innerHTML = this.getIcon(t));
1105
+ const r = this.findButtonById(e);
1106
+ r && (r.icon = t);
1107
+ }
1093
1108
  updateButtonVisibility(e, t) {
1094
1109
  this.options.visibility || (this.options.visibility = {}), this.options.visibility[e] = t, this.render();
1095
1110
  }
@@ -1128,8 +1143,8 @@ class kd {
1128
1143
  class Tg extends kd {
1129
1144
  async init() {
1130
1145
  await super.init();
1131
- const e = this.options.registry, { createHomeButton: t } = await Promise.resolve().then(() => kT), { createZoomBoxButton: n } = await Promise.resolve().then(() => OT), { createWalkMenuButton: i } = await Promise.resolve().then(() => FT), { createMapButton: r } = await Promise.resolve().then(() => VT), { createPropertyButton: a } = await Promise.resolve().then(() => WT), { createSettingButton: o } = await Promise.resolve().then(() => jT), { createInfoButton: l } = await Promise.resolve().then(() => ZT), { createFullscreenButton: c } = await Promise.resolve().then(() => $T), { createMeasureButton: h } = await Promise.resolve().then(() => JT), { createSectionMenuButton: d } = await Promise.resolve().then(() => e4), { createSectionPlaneButton: p } = await Promise.resolve().then(() => n4), { createSectionAxisButton: u } = await Promise.resolve().then(() => s4), { createSectionBoxButton: g } = await Promise.resolve().then(() => a4), { createAiChatButton: f } = await Promise.resolve().then(() => l4);
1132
- this.addGroup("group-1"), this.addButton(t(e)), this.addButton(n(e)), this.addButton(h(e)), this.addButton(d(e)), this.addButton(p(e)), this.addButton(u(e)), this.addButton(g(e)), this.addButton(i(e)), this.addButton(r(e)), this.addButton(a(e)), this.addGroup("group-2"), this.addButton(f(e)), this.addButton(o(e)), this.addButton(l(e)), this.addButton(c(e)), this.render();
1146
+ const e = this.options.registry, { createHomeButton: t } = await Promise.resolve().then(() => kT), { createZoomBoxButton: n } = await Promise.resolve().then(() => OT), { createWalkMenuButton: i } = await Promise.resolve().then(() => FT), { createMapButton: r } = await Promise.resolve().then(() => VT), { createPropertyButton: a } = await Promise.resolve().then(() => WT), { createSettingButton: o } = await Promise.resolve().then(() => jT), { createInfoButton: l } = await Promise.resolve().then(() => ZT), { createFullscreenButton: c } = await Promise.resolve().then(() => $T), { createMeasureButton: h } = await Promise.resolve().then(() => JT), { createSectionMenuButton: d } = await Promise.resolve().then(() => e4), { createSectionPlaneButton: p } = await Promise.resolve().then(() => n4), { createSectionAxisButton: u } = await Promise.resolve().then(() => s4), { createSectionBoxButton: g } = await Promise.resolve().then(() => a4), { createAiChatButton: f } = await Promise.resolve().then(() => l4), { createCameraSwitchButton: x } = await Promise.resolve().then(() => h4);
1147
+ this.addGroup("group-1"), this.addButton(t(e)), this.addButton(x(e)), this.addButton(n(e)), this.addButton(h(e)), this.addButton(d(e)), this.addButton(p(e)), this.addButton(u(e)), this.addButton(g(e)), this.addButton(i(e)), this.addButton(r(e)), this.addButton(a(e)), this.addGroup("group-2"), this.addButton(f(e)), this.addButton(o(e)), this.addButton(l(e)), this.addButton(c(e)), this.render();
1133
1148
  }
1134
1149
  }
1135
1150
  class Ui {
@@ -1249,6 +1264,14 @@ class Ag extends Ui {
1249
1264
  setBtnActive(e, t) {
1250
1265
  this.toolbar?.setBtnActive(e, t);
1251
1266
  }
1267
+ /**
1268
+ * 更新按钮图标
1269
+ * @param id 按钮 ID
1270
+ * @param icon 新的 SVG 图标字符串
1271
+ */
1272
+ updateButtonIcon(e, t) {
1273
+ this.toolbar?.updateButtonIcon(e, t);
1274
+ }
1252
1275
  /**
1253
1276
  * 设置工具栏可见性
1254
1277
  * @param visible 是否可见
@@ -1537,18 +1560,18 @@ class Rg {
1537
1560
  initResize() {
1538
1561
  const e = this.element.querySelector(".bim-dialog-resize-handle");
1539
1562
  if (!e) return;
1540
- let t = 0, n = 0, i = 0, r = 0;
1541
- const a = (c) => {
1542
- c.preventDefault(), c.stopPropagation(), t = c.clientX, n = c.clientY, i = this.element.offsetWidth, r = this.element.offsetHeight, document.addEventListener("mousemove", o, { capture: !0 }), document.addEventListener("mouseup", l, { capture: !0 });
1543
- }, o = (c) => {
1544
- c.preventDefault(), c.stopPropagation(), !this.rafId && (this.rafId = requestAnimationFrame(() => {
1545
- const h = c.clientX - t, d = c.clientY - n, p = Math.max(this.options.minWidth || 100, i + h), u = Math.max(this.options.minHeight || 50, r + d);
1546
- this.element.style.width = `${p}px`, this.element.style.height = `${u}px`, this.rafId = null;
1563
+ let t = 0, n = 0, i = 0, r = 0, a = 0, o = 0, l = 0, c = 0;
1564
+ const h = (u) => {
1565
+ u.preventDefault(), u.stopPropagation(), t = u.clientX, n = u.clientY, i = this.element.offsetWidth, r = this.element.offsetHeight, a = this.container.clientWidth, o = this.container.clientHeight, l = this.element.offsetLeft, c = this.element.offsetTop, document.addEventListener("mousemove", d, { capture: !0 }), document.addEventListener("mouseup", p, { capture: !0 });
1566
+ }, d = (u) => {
1567
+ u.preventDefault(), u.stopPropagation(), !this.rafId && (this.rafId = requestAnimationFrame(() => {
1568
+ const g = u.clientX - t, f = u.clientY - n, x = a - l, m = o - c, b = Math.min(x, Math.max(this.options.minWidth || 100, i + g)), v = Math.min(m, Math.max(this.options.minHeight || 50, r + f));
1569
+ this.element.style.width = `${b}px`, this.element.style.height = `${v}px`, this.rafId = null;
1547
1570
  }));
1548
- }, l = () => {
1549
- this.rafId && (cancelAnimationFrame(this.rafId), this.rafId = null), document.removeEventListener("mousemove", o, { capture: !0 }), document.removeEventListener("mouseup", l, { capture: !0 });
1571
+ }, p = () => {
1572
+ this.rafId && (cancelAnimationFrame(this.rafId), this.rafId = null), document.removeEventListener("mousemove", d, { capture: !0 }), document.removeEventListener("mouseup", p, { capture: !0 });
1550
1573
  };
1551
- e.addEventListener("mousedown", a);
1574
+ e.addEventListener("mousedown", h);
1552
1575
  }
1553
1576
  /**
1554
1577
  * 动态设置内容
@@ -29468,7 +29491,7 @@ function T_(s) {
29468
29491
  }
29469
29492
  class ef {
29470
29493
  constructor(e, t, n, i) {
29471
- this._Engine = e, this.camera = t, this.domElement = n, this._isEnabled = !1, this._rayOriginOffset = new P(0, -1, 0), this._camerLocalDirection = new P(), this._tmpVector = new P(), this._rayCaster = new os(), this._fallingTime = 0, this._euler = new Bn(0, 0, 0, "YZX"), this._prevMouseX = 0, this._prevMouseY = 0, this.applyGravity = !1, this.gravityMinHeight = !0, this.applyCollision = !0, this.positionEasing = !0, this.lookflag = 1, this.lookSpeed = 8e-3, this.moveSpeed = 0.02, this.playerHeight = 1.4, this.maxRotateX = 0.8, this.g = 9.8, this.bindmousedown = this._Engine && this._Engine.DeviceType !== "PC" ? this.onTouchStart.bind(this) : this.onMouseDown.bind(this), this.bindmouseup = this._Engine && this._Engine.DeviceType !== "PC" ? this.onTouchEnd.bind(this) : this.onMouseUp.bind(this), this.bindmousemove = this._Engine && this._Engine.DeviceType !== "PC" ? this.onTouchMove.bind(this) : this.onMouseMove.bind(this), this.bindonKeyDown = this.onKeyDown.bind(this), this.bindonKeyUp = this.onKeyUp.bind(this), this.bindMousewheel = this.onMousewheel.bind(this), this.needMousewheel = !1, this.moveWheelRun = !0, this.moveWheelStop = !1, this.wheelClock, this.keydown = !1, this.GetEngine = () => e;
29494
+ this._Engine = e, this.camera = t, this.domElement = n, this._isEnabled = !1, this._rayOriginOffset = new P(0, -1, 0), this._camerLocalDirection = new P(), this._tmpVector = new P(), this._rayCaster = new os(), this._fallingTime = 0, this._euler = new Bn(0, 0, 0, "YZX"), this._prevMouseX = 0, this._prevMouseY = 0, this.applyGravity = !1, this.gravityMinHeight = !0, this.applyCollision = !0, this.positionEasing = !0, this.lookflag = 1, this.lookSpeed = 8e-3, this.moveSpeed = 0.02, this.playerHeight = 1.4, this.maxRotateX = 0.8, this.g = 9.8, this.bindmousedown = this._Engine && this._Engine.deviceType !== "PC" ? this.onTouchStart.bind(this) : this.onMouseDown.bind(this), this.bindmouseup = this._Engine && this._Engine.deviceType !== "PC" ? this.onTouchEnd.bind(this) : this.onMouseUp.bind(this), this.bindmousemove = this._Engine && this._Engine.deviceType !== "PC" ? this.onTouchMove.bind(this) : this.onMouseMove.bind(this), this.bindonKeyDown = this.onKeyDown.bind(this), this.bindonKeyUp = this.onKeyUp.bind(this), this.bindMousewheel = this.onMousewheel.bind(this), this.needMousewheel = !1, this.moveWheelRun = !0, this.moveWheelStop = !1, this.wheelClock, this.keydown = !1, this.GetEngine = () => e;
29472
29495
  }
29473
29496
  /**
29474
29497
  * @param {Object} colliders set objects for collision detection
@@ -29493,7 +29516,7 @@ class ef {
29493
29516
  console.log("[FirstPersonCameraControl] addEvents - DeviceType:", e, "isPC:", t), t ? (console.log("[FirstPersonCameraControl] 添加鼠标事件监听器 - mousedown, mouseup"), this.domElement.addEventListener("mousedown", this.bindmousedown, !1), this.domElement.addEventListener("mouseup", this.bindmouseup, !1)) : (console.log("[FirstPersonCameraControl] 添加触摸事件监听器"), this.domElement.addEventListener("touchstart", this.bindmousedown, !1), this.domElement.addEventListener("touchend", this.bindmouseup, !1)), window.addEventListener("keydown", this.bindonKeyDown, !1), window.addEventListener("keyup", this.bindonKeyUp, !1), this.needMousewheel && (document.addEventListener && document.addEventListener("DOMMouseScroll", this.bindMousewheel, !1), window.addEventListener("mousewheel", this.bindMousewheel, !1));
29494
29517
  }
29495
29518
  removeEvents() {
29496
- this._Engine && this._Engine.DeviceType !== "PC" ? (this.domElement.removeEventListener("touchstart", this.bindmousedown), this.domElement.removeEventListener("touchend", this.bindmouseup), this.domElement.removeEventListener("touchmove", this.bindmousemove)) : (this.domElement.removeEventListener("mousedown", this.bindmousedown), this.domElement.removeEventListener("mouseup", this.bindmouseup), this.domElement.removeEventListener("mousemove", this.bindmousemove)), window.removeEventListener("keydown", this.bindonKeyDown), window.removeEventListener("keyup", this.bindonKeyUp), this.needMousewheel && (document.addEventListener && document.removeEventListener("DOMMouseScroll", this.bindMousewheel), window.removeEventListener("mousewheel", this.bindMousewheel));
29519
+ this._Engine && this._Engine.deviceType !== "PC" ? (this.domElement.removeEventListener("touchstart", this.bindmousedown), this.domElement.removeEventListener("touchend", this.bindmouseup), this.domElement.removeEventListener("touchmove", this.bindmousemove)) : (this.domElement.removeEventListener("mousedown", this.bindmousedown), this.domElement.removeEventListener("mouseup", this.bindmouseup), this.domElement.removeEventListener("mousemove", this.bindmousemove)), window.removeEventListener("keydown", this.bindonKeyDown), window.removeEventListener("keyup", this.bindonKeyUp), this.needMousewheel && (document.addEventListener && document.removeEventListener("DOMMouseScroll", this.bindMousewheel), window.removeEventListener("mousewheel", this.bindMousewheel));
29497
29520
  }
29498
29521
  onMousewheel(e) {
29499
29522
  debugger;
@@ -30036,11 +30059,11 @@ class A_ {
30036
30059
  }
30037
30060
  // 设置漫游速度
30038
30061
  setMoveSpeed(e) {
30039
- this.firstPersonControls.moveSpeed = e;
30062
+ this.firstPersonControls.moveSpeed = e * 0.1;
30040
30063
  }
30041
30064
  // 获取当前移动速度
30042
30065
  getMoveSpeed() {
30043
- return this.firstPersonControls.moveSpeed;
30066
+ return this.firstPersonControls.moveSpeed * 10;
30044
30067
  }
30045
30068
  // 设置是否碰撞
30046
30069
  setApplyCollision(e) {
@@ -30073,7 +30096,7 @@ class A_ {
30073
30096
  }
30074
30097
  // 切换默认模式
30075
30098
  switchDefaultMode() {
30076
- this.firstPersonControls && (this.firstPersonControls.enabled = !1, this.engine.cameraModule.switchToOrthographicCamera()), this.orbitControls.enabled = !0;
30099
+ this.firstPersonControls && (this.firstPersonControls.enabled = !1), this.orbitControls.enabled = !0;
30077
30100
  }
30078
30101
  // 控制鼠标交互
30079
30102
  handleMouseUp(e) {
@@ -36336,22 +36359,22 @@ kt.getAdapter = W0.getAdapter;
36336
36359
  kt.HttpStatusCode = yd;
36337
36360
  kt.default = kt;
36338
36361
  const {
36339
- Axios: m4,
36340
- AxiosError: g4,
36341
- CanceledError: x4,
36342
- isCancel: v4,
36343
- CancelToken: b4,
36344
- VERSION: y4,
36345
- all: _4,
36346
- Cancel: M4,
36347
- isAxiosError: w4,
36348
- spread: S4,
36349
- toFormData: E4,
36350
- AxiosHeaders: C4,
36351
- HttpStatusCode: T4,
36352
- formToJSON: A4,
36353
- getAdapter: P4,
36354
- mergeConfig: R4
36362
+ Axios: x4,
36363
+ AxiosError: v4,
36364
+ CanceledError: b4,
36365
+ isCancel: y4,
36366
+ CancelToken: _4,
36367
+ VERSION: M4,
36368
+ all: w4,
36369
+ Cancel: S4,
36370
+ isAxiosError: E4,
36371
+ spread: C4,
36372
+ toFormData: T4,
36373
+ AxiosHeaders: A4,
36374
+ HttpStatusCode: P4,
36375
+ formToJSON: R4,
36376
+ getAdapter: L4,
36377
+ mergeConfig: I4
36355
36378
  } = kt;
36356
36379
  function _f(s, e) {
36357
36380
  var t;
@@ -38820,7 +38843,7 @@ function oS(s, e, t) {
38820
38843
  indexes: /* @__PURE__ */ new Map()
38821
38844
  }) : (n.find((a) => a.glb == i.glb).meshes.push(i), n.find((a) => a.glb == i.glb).currentIndex += i.geometry.index.count);
38822
38845
  let r = n.find((a) => a.glb == i.glb);
38823
- r.indexes.set(Number(i.name), [r.currentIndex - i.geometry.index.count, r.currentIndex]);
38846
+ r.indexes.has(Number(i.name)) ? r.indexes.get(Number(i.name)).push([r.currentIndex - i.geometry.index.count, r.currentIndex]) : r.indexes.set(Number(i.name), [[r.currentIndex - i.geometry.index.count, r.currentIndex]]);
38824
38847
  }), n.forEach((i) => {
38825
38848
  let r = e.scene.children.find((a) => a instanceof at && a.url == s && a.glb == i.glb);
38826
38849
  if (r != null)
@@ -38834,7 +38857,9 @@ function oS(s, e, t) {
38834
38857
  if (c != null) {
38835
38858
  let h = 0;
38836
38859
  i.indexes.forEach((d) => {
38837
- c.nodesMap.get(Number(i.meshes[h].name)).indexes == null && (c.nodesMap.get(Number(i.meshes[h].name)).indexes = []), c.nodesMap.get(Number(i.meshes[h].name)).indexes.push([l.index, h++, d[0], d[1]]);
38860
+ d.forEach((p) => {
38861
+ c.nodesMap.get(Number(i.meshes[h].name)).indexes == null && (c.nodesMap.get(Number(i.meshes[h].name)).indexes = []), c.nodesMap.get(Number(i.meshes[h].name)).indexes.push([l.index, h++, p[0], p[1]]);
38862
+ });
38838
38863
  });
38839
38864
  }
38840
38865
  }
@@ -39056,7 +39081,7 @@ class fS {
39056
39081
  if (n.object.isInstance) {
39057
39082
  let a = n.matrix, o = [];
39058
39083
  r.indexes.forEach((c) => {
39059
- let h = r.indexes[c][0], d = this.engine.scene.children[h].boundingSphere;
39084
+ let h = c[0], d = this.engine.scene.children[h].geometry.boundingSphere;
39060
39085
  const p = new mt(), u = d.center.clone().applyMatrix4(a), g = d.radius, f = new P();
39061
39086
  f.setFromMatrixScale(a);
39062
39087
  const x = Math.max(f.x, f.y, f.z), m = g * x;
@@ -40299,16 +40324,18 @@ function PS(s, e, t) {
40299
40324
  }, n.CameraGoHome = function() {
40300
40325
  var g = s.octreeBox.getBoundingBox(), f = g.min.clone().add(g.max.clone()).multiplyScalar(0.5);
40301
40326
  let x = new P(1, 1, 1);
40302
- var m = g.max.distanceTo(g.min), b = f.clone().add(x.multiplyScalar(m));
40327
+ var m = g.max.distanceTo(g.min), b = f.clone().add(x.multiplyScalar(m * 0.5));
40303
40328
  if (e.camera.isOrthographicCamera) {
40304
40329
  var v = s.container.clientWidth / s.container.clientHeight, y = m * 0.6;
40305
40330
  e.camera.left = -y * v, e.camera.right = y * v, e.camera.top = y, e.camera.bottom = -y, e.camera.zoom = 1, e.camera.updateProjectionMatrix();
40306
40331
  }
40307
40332
  l(e.camera.position, b, s.controls.target.clone(), f);
40308
40333
  }, n.zoomToBox = function(g) {
40309
- var f = g.min.clone().add(g.max.clone()).multiplyScalar(0.5), x = e.camera.position.clone().sub(s.controls.target.clone()).normalize(), m = e.camera.position.distanceTo(s.controls.target), b = f.clone().add(x.multiplyScalar(m)), v = e.camera.zoom;
40310
40334
  if (e.camera.isOrthographicCamera) {
40311
- var y = new P(1, 0, 0).applyQuaternion(e.camera.quaternion), _ = new P(0, 1, 0).applyQuaternion(e.camera.quaternion), M = [
40335
+ let $ = function() {
40336
+ i = requestAnimationFrame($), X.update();
40337
+ };
40338
+ var f = g.min.clone().add(g.max.clone()).multiplyScalar(0.5), x = e.camera.position.clone().sub(s.controls.target.clone()).normalize(), m = e.camera.position.distanceTo(s.controls.target), b = f.clone().add(x.multiplyScalar(m)), v = e.camera.zoom, y = new P(1, 0, 0).applyQuaternion(e.camera.quaternion), _ = new P(0, 1, 0).applyQuaternion(e.camera.quaternion), M = [
40312
40339
  new P(g.min.x, g.min.y, g.min.z),
40313
40340
  new P(g.max.x, g.min.y, g.min.z),
40314
40341
  new P(g.min.x, g.max.y, g.min.z),
@@ -40324,33 +40351,34 @@ function PS(s, e, t) {
40324
40351
  }
40325
40352
  var S = (R - T) / 2, U = (E - w) / 2, H = (e.camera.right - e.camera.left) / 2, G = (e.camera.top - e.camera.bottom) / 2;
40326
40353
  v = Math.min(H / S, G / U) * 0.75;
40354
+ var Z = e.camera.position.clone(), j = s.controls.target.clone(), ie = e.camera.zoom, X = new la.Tween({
40355
+ x1: Z.x,
40356
+ y1: Z.y,
40357
+ z1: Z.z,
40358
+ x2: j.x,
40359
+ y2: j.y,
40360
+ z2: j.z,
40361
+ zoom: ie
40362
+ }).to({
40363
+ x1: b.x,
40364
+ y1: b.y,
40365
+ z1: b.z,
40366
+ x2: f.x,
40367
+ y2: f.y,
40368
+ z2: f.z,
40369
+ zoom: v
40370
+ }, 1e3);
40371
+ X.onUpdate(function(ue) {
40372
+ s.controls && (e.camera.position.set(ue.x1, ue.y1, ue.z1), s.controls.target.set(ue.x2, ue.y2, ue.z2), e.camera.isOrthographicCamera && (e.camera.zoom = ue.zoom, e.camera.updateProjectionMatrix()), s.controls.auto = !0, s.controls.update(), n.RenderScene());
40373
+ }), X.onComplete(function() {
40374
+ s.controls && (s.controls.auto = !1, n.RenderScene(), cancelAnimationFrame(i), i = null);
40375
+ }), X.easing(la.Easing.Cubic.InOut), X.start(), $();
40376
+ } else {
40377
+ var f = g.min.clone().add(g.max.clone()).multiplyScalar(0.5);
40378
+ let ue = e.camera.position.clone().sub(s.controls.target.clone()).normalize();
40379
+ var b = f.clone().add(ue.multiplyScalar(2 * g.max.distanceTo(g.min)));
40380
+ l(e.camera.position, b, s.controls.target.clone(), f);
40327
40381
  }
40328
- var Z = e.camera.position.clone(), j = s.controls.target.clone(), ie = e.camera.zoom, X = new la.Tween({
40329
- x1: Z.x,
40330
- y1: Z.y,
40331
- z1: Z.z,
40332
- x2: j.x,
40333
- y2: j.y,
40334
- z2: j.z,
40335
- zoom: ie
40336
- }).to({
40337
- x1: b.x,
40338
- y1: b.y,
40339
- z1: b.z,
40340
- x2: f.x,
40341
- y2: f.y,
40342
- z2: f.z,
40343
- zoom: v
40344
- }, 1e3);
40345
- X.onUpdate(function(ue) {
40346
- s.controls && (e.camera.position.set(ue.x1, ue.y1, ue.z1), s.controls.target.set(ue.x2, ue.y2, ue.z2), e.camera.isOrthographicCamera && (e.camera.zoom = ue.zoom, e.camera.updateProjectionMatrix()), s.controls.auto = !0, s.controls.update(), n.RenderScene());
40347
- }), X.onComplete(function() {
40348
- s.controls && (s.controls.auto = !1, n.RenderScene(), cancelAnimationFrame(i), i = null);
40349
- }), X.easing(la.Easing.Cubic.InOut), X.start();
40350
- function $() {
40351
- i = requestAnimationFrame($), X.update();
40352
- }
40353
- $();
40354
40382
  };
40355
40383
  function l(g, f, x, m, b, v, y = 1e3, _) {
40356
40384
  var M;
@@ -41700,7 +41728,7 @@ class OS {
41700
41728
  this.points = [];
41701
41729
  }
41702
41730
  handleMouseUp(e) {
41703
- this.engine.DeviceType != "PC" && this.createMeasure();
41731
+ this.engine.deviceType != "PC" && this.createMeasure();
41704
41732
  }
41705
41733
  handleMouseMove(e) {
41706
41734
  if (e.catch == null)
@@ -46202,11 +46230,11 @@ class GC {
46202
46230
  try {
46203
46231
  this.config = i, this.llmApi = new VC(i.llmConfig);
46204
46232
  try {
46205
- const r = await Promise.resolve().then(() => h4);
46233
+ const r = await Promise.resolve().then(() => u4);
46206
46234
  this.prompts.main = r.default;
46207
- const a = await Promise.resolve().then(() => u4);
46235
+ const a = await Promise.resolve().then(() => f4);
46208
46236
  this.prompts.step = a.default;
46209
- const o = await Promise.resolve().then(() => f4);
46237
+ const o = await Promise.resolve().then(() => g4);
46210
46238
  this.prompts.apiDoc = o.default;
46211
46239
  } catch (r) {
46212
46240
  throw console.error("[AI Manager] 提示词文件加载失败:", r), new Error(`提示词文件加载失败: ${r.message || "未知错误"}`);
@@ -47578,7 +47606,7 @@ class tT {
47578
47606
  // 业务数据
47579
47607
  models = [];
47580
47608
  reactBoundingClientRect = { left: 0, top: 0 };
47581
- version = "2.0.6";
47609
+ version = "2.1.1";
47582
47610
  versionEl = null;
47583
47611
  // 引擎容器
47584
47612
  container;
@@ -48227,6 +48255,26 @@ class Ki {
48227
48255
  this.engine.clipping.reverse();
48228
48256
  }
48229
48257
  // ==================== 结束:剖切功能 ====================
48258
+ // ==================== 相机切换 ====================
48259
+ /**
48260
+ * 切换相机类型(透视/正交)
48261
+ * @remarks 底层调用 cameraModule.switchCurrentCamera(),保留当前相机位置
48262
+ */
48263
+ switchCamera() {
48264
+ if (!this._isInitialized || !this.engine?.cameraModule) {
48265
+ console.warn("[Engine] Cannot switch camera: engine not initialized.");
48266
+ return;
48267
+ }
48268
+ this.engine.cameraModule.switchCurrentCamera();
48269
+ }
48270
+ /**
48271
+ * 获取当前相机类型
48272
+ * @returns 'perspective' | 'orthographic'
48273
+ */
48274
+ getCameraType() {
48275
+ return !this._isInitialized || !this.engine?.cameraModule ? "perspective" : this.engine.cameraModule.getCameraType() === 1 ? "orthographic" : "perspective";
48276
+ }
48277
+ // ==================== 结束:相机切换 ====================
48230
48278
  // ==================== 渲染模式 ====================
48231
48279
  /**
48232
48280
  * 获取当前渲染模式
@@ -48473,7 +48521,7 @@ class Ki {
48473
48521
  * @returns true=显示,false=隐藏
48474
48522
  */
48475
48523
  getMiniMapState() {
48476
- return !this._isInitialized || !this.engine ? !1 : this.engine.minMap?.getState() ?? !1;
48524
+ return !this._isInitialized || !this.engine ? !1 : this.engine.minMap?.getstate() ?? !1;
48477
48525
  }
48478
48526
  /**
48479
48527
  * 获取漫游模式是否激活
@@ -49781,6 +49829,9 @@ const pm = {
49781
49829
  settings: '<svg width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M12 15.5A3.5 3.5 0 0 1 8.5 12A3.5 3.5 0 0 1 12 8.5a3.5 3.5 0 0 1 3.5 3.5a3.5 3.5 0 0 1-3.5 3.5m7.43-2.53c.04-.32.07-.64.07-.97c0-.33-.03-.66-.07-1l2.11-1.63c.19-.15.24-.42.12-.64l-2-3.46c-.12-.22-.39-.31-.61-.22l-2.49 1c-.52-.39-1.06-.73-1.69-.98l-.37-2.65A.506.506 0 0 0 14 2h-4c-.25 0-.46.18-.5.42l-.37 2.65c-.63.25-1.17.59-1.69.98l-2.49-1c-.22-.09-.49 0-.61.22l-2 3.46c-.13.22-.07.49.12.64L4.57 11c-.04.34-.07.67-.07 1c0 .33.03.65.07.97l-2.11 1.66c-.19.15-.25.42-.12.64l2 3.46c.12.22.39.3.61.22l2.49-1.01c.52.4 1.06.74 1.69.99l.37 2.65c.04.24.25.42.5.42h4c.25 0 .46-.18.5-.42l.37-2.65c.63-.26 1.17-.59 1.69-.99l2.49 1.01c.22.08.49 0 .61-.22l2-3.46c.12-.22.07-.49-.12-.64l-2.11-1.66Z"/></svg>',
49782
49830
  loader: '<svg width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M12 4V2A10 10 0 0 0 2 12h2a8 8 0 0 1 8-8Z"><animateTransform attributeName="transform" dur="0.75s" repeatCount="indefinite" type="rotate" values="0 12 12;360 12 12"/></path></svg>',
49783
49831
  send: '<svg width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M2 21l21-9L2 3v7l15 2l-15 2v7z"/></svg>',
49832
+ // ========== 相机切换图标 (48x48) ==========
49833
+ 透视相机: '<svg width="48" height="48" viewBox="0 0 48 48"><path fill="currentColor" d="M24 4L4 14v20l20 10l20-10V14L24 4zm0 4.5l14 7v14l-14 7l-14-7v-14l14-7zM24 18a6 6 0 100 12a6 6 0 000-12z"/></svg>',
49834
+ 正交相机: '<svg width="48" height="48" viewBox="0 0 48 48"><path fill="currentColor" d="M6 6h36v36H6V6zm4 4v28h28V10H10zm4 4h20v20H14V14z"/></svg>',
49784
49835
  // ========== 默认图标 ==========
49785
49836
  default: '<svg width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10s10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8s8 3.59 8 8s-3.59 8-8 8zm-1-13h2v6h-2zm0 8h2v2h-2z"/></svg>'
49786
49837
  };
@@ -51931,40 +51982,42 @@ class MT extends Ui {
51931
51982
  return;
51932
51983
  }
51933
51984
  this.registry.toolbar.hide(), console.log("[WalkControl] 打开漫游面板,激活第一人称模式"), this.engineComponent?.activateFirstPersonMode(), this.panel = new bT({
51934
- onPlanViewToggle: (e) => {
51935
- console.log("[WalkControl] 小地图:", e), this.engineComponent?.toggleMiniMap(), this.emit("walk:plan-view-toggle", { isActive: e });
51985
+ onPlanViewToggle: (t) => {
51986
+ console.log("[WalkControl] 小地图:", t), this.engineComponent?.toggleMiniMap(), this.registry.toolbar?.setBtnActive("map", t), this.emit("walk:plan-view-toggle", { isActive: t });
51936
51987
  },
51937
- onPathModeToggle: (e) => {
51938
- console.log("[WalkControl] 路径漫游:", e), e ? this.pathManager?.show() : this.pathManager?.hide(), this.emit("walk:path-mode-toggle", { isActive: e });
51988
+ onPathModeToggle: (t) => {
51989
+ console.log("[WalkControl] 路径漫游:", t), t ? this.pathManager?.show() : this.pathManager?.hide(), this.emit("walk:path-mode-toggle", { isActive: t });
51939
51990
  },
51940
- onWalkModeToggle: (e) => {
51941
- console.log("[WalkControl] 第三人称漫游按钮点击:", e), e && (this.pathManager?.hide(), alert("第三人称功能开发中")), this.emit("walk:walk-mode-toggle", { isActive: e });
51991
+ onWalkModeToggle: (t) => {
51992
+ console.log("[WalkControl] 第三人称漫游按钮点击:", t), t && (this.pathManager?.hide(), alert("第三人称功能开发中")), this.emit("walk:walk-mode-toggle", { isActive: t });
51942
51993
  },
51943
- onSpeedChange: (e) => {
51944
- console.log("[WalkControl] 速度变化:", e);
51945
- const t = e * 0.1;
51946
- this.engineComponent?.setWalkSpeed(t), this.emit("walk:speed-change", { speed: e });
51994
+ onSpeedChange: (t) => {
51995
+ console.log("[WalkControl] 速度变化:", t);
51996
+ const n = t * 0.1;
51997
+ this.engineComponent?.setWalkSpeed(n), this.emit("walk:speed-change", { speed: t });
51947
51998
  },
51948
- onGravityToggle: (e) => {
51949
- console.log("[WalkControl] 重力:", e), this.engineComponent?.setWalkGravity(e), this.emit("walk:gravity-toggle", { enabled: e });
51999
+ onGravityToggle: (t) => {
52000
+ console.log("[WalkControl] 重力:", t), this.engineComponent?.setWalkGravity(t), this.emit("walk:gravity-toggle", { enabled: t });
51950
52001
  },
51951
- onCollisionToggle: (e) => {
51952
- console.log("[WalkControl] 碰撞:", e), this.engineComponent?.setWalkCollision(e), this.emit("walk:collision-toggle", { enabled: e });
52002
+ onCollisionToggle: (t) => {
52003
+ console.log("[WalkControl] 碰撞:", t), this.engineComponent?.setWalkCollision(t), this.emit("walk:collision-toggle", { enabled: t });
51953
52004
  },
51954
- onCharacterModelChange: (e) => {
51955
- console.log("[WalkControl] 角色模型:", e);
52005
+ onCharacterModelChange: (t) => {
52006
+ console.log("[WalkControl] 角色模型:", t);
51956
52007
  },
51957
- onWalkModeChange: (e) => {
51958
- console.log("[WalkControl] 行走模式:", e);
52008
+ onWalkModeChange: (t) => {
52009
+ console.log("[WalkControl] 行走模式:", t);
51959
52010
  },
51960
52011
  onExit: () => {
51961
52012
  this.hide();
51962
52013
  }
51963
- }), this.panel.init(), this.registry.container ? (this.panel.element.style.position = "absolute", this.panel.element.style.bottom = "20px", this.panel.element.style.left = "50%", this.panel.element.style.transform = "translateX(-50%)", this.panel.element.style.zIndex = "1000", this.registry.container.appendChild(this.panel.element)) : console.warn("[WalkControlManager] Container not found");
52014
+ }), this.panel.init();
52015
+ const e = this.engineComponent?.getMiniMapState() ?? !1;
52016
+ this.panel.setPlanViewActive(e), this.registry.container ? (this.panel.element.style.position = "absolute", this.panel.element.style.bottom = "20px", this.panel.element.style.left = "50%", this.panel.element.style.transform = "translateX(-50%)", this.panel.element.style.zIndex = "1000", this.registry.container.appendChild(this.panel.element)) : console.warn("[WalkControlManager] Container not found");
51964
52017
  }
51965
52018
  /** 隐藏漫游控制面板 */
51966
52019
  hide() {
51967
- this.pathManager?.hide(), console.log("[WalkControl] 关闭漫游面板,退出第一人称模式"), this.engineComponent?.deactivateFirstPersonMode(), this.panel && (this.panel.destroy(), this.panel = null), this.registry.toolbar && this.registry.toolbar.show();
52020
+ this.pathManager?.hide(), this.engineComponent?.getMiniMapState() && this.engineComponent.toggleMiniMap(), console.log("[WalkControl] 关闭漫游面板,退出第一人称模式"), this.engineComponent?.deactivateFirstPersonMode(), this.panel && (this.panel.destroy(), this.panel = null), this.registry.toolbar?.setBtnActive("map", !1), this.registry.toolbar && this.registry.toolbar.show();
51968
52021
  }
51969
52022
  /** 销毁管理器 */
51970
52023
  destroy() {
@@ -53372,7 +53425,7 @@ class NT {
53372
53425
  this.eventEmitter.clear();
53373
53426
  }
53374
53427
  }
53375
- class L4 {
53428
+ class D4 {
53376
53429
  container;
53377
53430
  wrapper = null;
53378
53431
  registry;
@@ -53417,7 +53470,7 @@ class L4 {
53417
53470
  init() {
53418
53471
  this.container.innerHTML = "", this.wrapper = document.createElement("div"), this.wrapper.className = "bim-engine-wrapper", this.container.appendChild(this.wrapper);
53419
53472
  const e = document.createElement("div");
53420
- e.className = "bim-engine-version", e.textContent = "v1.3.3", this.wrapper.appendChild(e), this.registry.container = this.container, this.registry.wrapper = this.wrapper, this.engine = new sT(this.wrapper, this.registry), this.dialog = new Lg(this.wrapper, this.registry), this.toolbar = new Ag(this.wrapper, this.registry), this.buttonGroup = new Pg(this.wrapper, this.registry), this.rightKey = new ug(this.wrapper, this.registry), this.constructTreeBtn = new hT(this.wrapper, this.registry), this.measure = new uT(this.registry), this.sectionPlane = new fT(this.registry), this.sectionAxis = new gT(this.registry), this.sectionBox = new vT(this.registry), this.walkControl = new MT(this.registry), this.walkControl.init(), this.engineInfo = new wT(this.registry), this.engineInfo.init(), this.registry.engine3d = this.engine, this.registry.dialog = this.dialog, this.registry.toolbar = this.toolbar, this.registry.buttonGroup = this.buttonGroup, this.registry.rightKey = this.rightKey, this.registry.constructTree = this.constructTreeBtn, this.registry.measure = this.measure, this.registry.sectionPlane = this.sectionPlane, this.registry.sectionAxis = this.sectionAxis, this.registry.sectionBox = this.sectionBox, this.registry.walkControl = this.walkControl, this.registry.engineInfo = this.engineInfo, this.componentDetail = new RT(this.registry), this.registry.componentDetail = this.componentDetail, this.componentDetail.init(), this.aiChat = new IT(this.registry), this.registry.aiChat = this.aiChat, this.aiChat.init(), this.setting = new AT(this.registry), this.registry.setting = this.setting, this.setting.init(), this.updateTheme(lt.getTheme()), lt.subscribe((t) => {
53473
+ e.className = "bim-engine-version", e.textContent = "v1.4.0", this.wrapper.appendChild(e), this.registry.container = this.container, this.registry.wrapper = this.wrapper, this.engine = new sT(this.wrapper, this.registry), this.dialog = new Lg(this.wrapper, this.registry), this.toolbar = new Ag(this.wrapper, this.registry), this.buttonGroup = new Pg(this.wrapper, this.registry), this.rightKey = new ug(this.wrapper, this.registry), this.constructTreeBtn = new hT(this.wrapper, this.registry), this.measure = new uT(this.registry), this.sectionPlane = new fT(this.registry), this.sectionAxis = new gT(this.registry), this.sectionBox = new vT(this.registry), this.walkControl = new MT(this.registry), this.walkControl.init(), this.engineInfo = new wT(this.registry), this.engineInfo.init(), this.registry.engine3d = this.engine, this.registry.dialog = this.dialog, this.registry.toolbar = this.toolbar, this.registry.buttonGroup = this.buttonGroup, this.registry.rightKey = this.rightKey, this.registry.constructTree = this.constructTreeBtn, this.registry.measure = this.measure, this.registry.sectionPlane = this.sectionPlane, this.registry.sectionAxis = this.sectionAxis, this.registry.sectionBox = this.sectionBox, this.registry.walkControl = this.walkControl, this.registry.engineInfo = this.engineInfo, this.componentDetail = new RT(this.registry), this.registry.componentDetail = this.componentDetail, this.componentDetail.init(), this.aiChat = new IT(this.registry), this.registry.aiChat = this.aiChat, this.aiChat.init(), this.setting = new AT(this.registry), this.registry.setting = this.setting, this.setting.init(), this.updateTheme(lt.getTheme()), lt.subscribe((t) => {
53421
53474
  this.updateTheme(t);
53422
53475
  });
53423
53476
  }
@@ -53477,6 +53530,8 @@ const BT = (s) => ({
53477
53530
  icon: rt("地图"),
53478
53531
  onClick: () => {
53479
53532
  s.engine3d?.getEngineComponent()?.toggleMiniMap();
53533
+ const e = s.engine3d?.getEngineComponent()?.getMiniMapState() ?? !1;
53534
+ s.walkControl?.panel?.setPlanViewActive(e);
53480
53535
  }
53481
53536
  }), VT = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
53482
53537
  __proto__: null,
@@ -53642,7 +53697,24 @@ const BT = (s) => ({
53642
53697
  }), l4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
53643
53698
  __proto__: null,
53644
53699
  createAiChatButton: o4
53645
- }, Symbol.toStringTag, { value: "Module" })), c4 = `# BIM引擎AI助手 - 需求分析与步骤规划专家\r
53700
+ }, Symbol.toStringTag, { value: "Module" })), c4 = (s) => ({
53701
+ id: "camera-switch",
53702
+ groupId: "group-1",
53703
+ type: "button",
53704
+ label: "toolbar.cameraSwitch",
53705
+ icon: rt("透视相机"),
53706
+ keepActive: !1,
53707
+ onClick: () => {
53708
+ const e = s.engine3d?.getEngineComponent();
53709
+ if (!e) return;
53710
+ e.switchCamera();
53711
+ const t = e.getCameraType(), n = rt(t === "orthographic" ? "正交相机" : "透视相机");
53712
+ s.toolbar?.updateButtonIcon("camera-switch", n);
53713
+ }
53714
+ }), h4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
53715
+ __proto__: null,
53716
+ createCameraSwitchButton: c4
53717
+ }, Symbol.toStringTag, { value: "Module" })), d4 = `# BIM引擎AI助手 - 需求分析与步骤规划专家\r
53646
53718
  \r
53647
53719
  ## 角色定位\r
53648
53720
  \r
@@ -53812,10 +53884,10 @@ json内容\r
53812
53884
  5. **用户友好**:步骤描述要清晰易懂,便于用户理解整个执行流程\r
53813
53885
  \r
53814
53886
  \r
53815
- ''`, h4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
53887
+ ''`, u4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
53816
53888
  __proto__: null,
53817
- default: c4
53818
- }, Symbol.toStringTag, { value: "Module" })), d4 = `# BIM引擎AI助手 - 代码生成专家\r
53889
+ default: d4
53890
+ }, Symbol.toStringTag, { value: "Module" })), p4 = `# BIM引擎AI助手 - 代码生成专家\r
53819
53891
  \r
53820
53892
  ## 角色定位\r
53821
53893
  \r
@@ -54061,10 +54133,10 @@ try {\r
54061
54133
  5. **代码可读性**:优先保证代码的可读性,而不是追求"高级"写法\r
54062
54134
  6. **注释清晰**:关键逻辑要有注释,但不要过度注释\r
54063
54135
  7. **性能考虑**:对于大量数据的处理,考虑性能优化\r
54064
- 8. **测试友好**:生成的代码应该便于测试和调试 `, u4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
54136
+ 8. **测试友好**:生成的代码应该便于测试和调试 `, f4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
54065
54137
  __proto__: null,
54066
- default: d4
54067
- }, Symbol.toStringTag, { value: "Module" })), p4 = `# BIM Engine SDK API 文档
54138
+ default: p4
54139
+ }, Symbol.toStringTag, { value: "Module" })), m4 = `# BIM Engine SDK API 文档
54068
54140
 
54069
54141
  本文档为 BIM Engine SDK 的完整 API 参考,适合大模型阅读和理解引擎的功能结构。
54070
54142
 
@@ -55568,11 +55640,11 @@ BIM Engine SDK 提供了完整的 3D BIM 模型渲染和交互能力,主要特
55568
55640
  - 施工模拟
55569
55641
  - 运维管理
55570
55642
  - AI 辅助设计
55571
- `, f4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
55643
+ `, g4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
55572
55644
  __proto__: null,
55573
- default: p4
55645
+ default: m4
55574
55646
  }, Symbol.toStringTag, { value: "Module" }));
55575
55647
  export {
55576
- L4 as BimEngine
55648
+ D4 as BimEngine
55577
55649
  };
55578
55650
  //# sourceMappingURL=iflow-engine.es.js.map