@fishdingding/bim-engine-sdk 1.0.1

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.
@@ -0,0 +1,1432 @@
1
+ /**
2
+ * 通用按钮组组件 (BimButtonGroup)
3
+ */
4
+ declare class BimButtonGroup implements IBimComponent {
5
+ private container;
6
+ private options;
7
+ private groups;
8
+ private activeBtnIds;
9
+ private btnRefs;
10
+ private dropdownElement;
11
+ private hoverTimeout;
12
+ private customColors;
13
+ private unsubscribeLocale;
14
+ private unsubscribeTheme;
15
+ protected engine: BimEngine | null;
16
+ private readonly DEFAULT_ICON;
17
+ constructor(options: ButtonGroupOptions);
18
+ setEngine(engine: BimEngine): void;
19
+ protected emit<K extends keyof EngineEvents>(event: K, payload: EngineEvents[K]): void;
20
+ private initContainer;
21
+ /**
22
+ * 设置事件拦截,防止事件冒泡到下层元素(如 3D 引擎)
23
+ */
24
+ private setupEventInterception;
25
+ private updatePosition;
26
+ /**
27
+ * 应用样式到容器
28
+ */
29
+ private applyStyles;
30
+ /**
31
+ * 设置主题的primary颜色(用于边框等)
32
+ */
33
+ private setPrimaryColor;
34
+ /**
35
+ * 设置主题颜色
36
+ * 只会应用到没有被用户自定义的颜色属性上
37
+ */
38
+ setTheme(theme: ThemeConfig): void;
39
+ /**
40
+ * 直接设置颜色(强制覆盖)
41
+ * 设置的颜色会被标记为自定义,后续的 setTheme 不会覆盖它们
42
+ */
43
+ setColors(colors: ButtonGroupColors): void;
44
+ init(): Promise<void>;
45
+ setLocales(): void;
46
+ addGroup(groupId: string, beforeGroupId?: string): void;
47
+ addButton(config: ButtonConfig): void;
48
+ private findButton;
49
+ render(): void;
50
+ private renderGroup;
51
+ private renderButton;
52
+ /**
53
+ * 设置按钮的激活状态
54
+ * @param id 按钮 ID
55
+ * @param active 可选,如果不传则切换(toggle)当前状态
56
+ */
57
+ setBtnActive(id: string, active?: boolean): void;
58
+ private handleClick;
59
+ /**
60
+ * 互斥关闭同范围内的其它已激活按钮,并触发它们的 onClick
61
+ * @param button 当前被激活的按钮
62
+ */
63
+ private deactivateExclusiveSiblings;
64
+ private handleMouseEnter;
65
+ private handleMouseLeave;
66
+ private showDropdown;
67
+ private renderDropdownItem;
68
+ private closeDropdown;
69
+ private updateButtonState;
70
+ private getIcon;
71
+ updateButtonVisibility(id: string, visible: boolean): void;
72
+ setShowLabel(show: boolean): void;
73
+ private updateLabelsVisibility;
74
+ private findButtonById;
75
+ setBackgroundColor(color: string): void;
76
+ private isVisible;
77
+ destroy(): void;
78
+ }
79
+
80
+ declare abstract class BimComponent {
81
+ protected engine: BimEngine;
82
+ constructor(engine: BimEngine);
83
+ /**
84
+ * Helper to send events easily
85
+ */
86
+ protected emit<K extends keyof EngineEvents>(event: K, payload: EngineEvents[K]): void;
87
+ /**
88
+ * Helper to listen to events easily
89
+ * Returns an unsubscribe function
90
+ */
91
+ protected on<K extends keyof EngineEvents>(event: K, listener: (payload: EngineEvents[K]) => void): () => void;
92
+ abstract destroy(): void;
93
+ }
94
+
95
+ /**
96
+ * 通用弹窗组件类
97
+ * 支持拖拽、缩放、自定义内容和位置。
98
+ */
99
+ declare class BimDialog implements IBimComponent {
100
+ private element;
101
+ private options;
102
+ private container;
103
+ private header;
104
+ private contentArea;
105
+ private _isDestroyed;
106
+ private _isInitialized;
107
+ private unsubscribeTheme;
108
+ private unsubscribeLocale;
109
+ private rafId;
110
+ /**
111
+ * 构造函数
112
+ * @param options 弹窗配置选项
113
+ */
114
+ constructor(options: DialogOptions);
115
+ /**
116
+ * 设置主题
117
+ * @param theme 全局主题配置
118
+ */
119
+ setTheme(theme: ThemeConfig): void;
120
+ /**
121
+ * 初始化组件功能 (接口实现)
122
+ */
123
+ init(): void;
124
+ setLocales(): void;
125
+ /**
126
+ * 创建弹窗的 DOM 结构
127
+ */
128
+ private createDom;
129
+ /**
130
+ * 设置元素尺寸
131
+ */
132
+ private setSize;
133
+ /**
134
+ * 根据内容自动调整弹窗宽度
135
+ * @param recenter 是否重新计算定位(例如保持居中),默认 true
136
+ */
137
+ fitWidth(recenter?: boolean): void;
138
+ /**
139
+ * 根据内容自动调整弹窗高度
140
+ *
141
+ * 设计说明:
142
+ * - 主要用于“内容展开/收起”场景(比如测量面板展开后,Dialog 高度跟随变化)
143
+ * - 默认不改变用户拖拽后的当前位置,只做边界夹紧,避免弹窗超出容器
144
+ *
145
+ * @param recenter 是否根据 options.position 重新定位(默认 false)
146
+ */
147
+ fitHeight(recenter?: boolean): void;
148
+ /**
149
+ * 边界夹紧:保持当前 left/top 不变的前提下,确保弹窗不超出容器
150
+ * 说明:用于 fitHeight / fitWidth 后的“尺寸变化”场景,避免弹窗被裁切。
151
+ */
152
+ private clampToContainer;
153
+ /**
154
+ * 初始化弹窗位置
155
+ */
156
+ private initPosition;
157
+ /**
158
+ * 初始化拖拽功能 (性能优化 + 解决粘手)
159
+ */
160
+ private initDrag;
161
+ /**
162
+ * 初始化缩放功能 (性能优化 + 解决粘手)
163
+ */
164
+ private initResize;
165
+ /**
166
+ * 动态设置内容
167
+ * @param content 内容元素或 HTML 字符串
168
+ */
169
+ setContent(content: HTMLElement | string): void;
170
+ /**
171
+ * 关闭弹窗并销毁
172
+ */
173
+ close(): void;
174
+ /**
175
+ * 销毁组件 (接口实现)
176
+ */
177
+ destroy(): void;
178
+ }
179
+
180
+ export declare class BimEngine extends EventEmitter {
181
+ container: HTMLElement;
182
+ private wrapper;
183
+ toolbar: ToolbarManager | null;
184
+ constructTreeBtn: ConstructTreeManagerBtn | null;
185
+ buttonGroup: ButtonGroupManager | null;
186
+ dialog: DialogManager | null;
187
+ engine: EngineManager | null;
188
+ rightKey: RightKeyManager | null;
189
+ propertyPanel: PropertyPanelManager | null;
190
+ measure: MeasureDialogManager | null;
191
+ sectionPlane: SectionPlaneDialogManager | null;
192
+ sectionAxis: SectionAxisDialogManager | null;
193
+ sectionBox: SectionBoxDialogManager | null;
194
+ walkControl: WalkControlManager | null;
195
+ map: MapDialogManager | null;
196
+ constructor(container: HTMLElement | string, options?: {
197
+ locale?: LocaleType;
198
+ theme?: ThemeType;
199
+ });
200
+ emit<K extends keyof EngineEvents>(event: K, payload: EngineEvents[K]): void;
201
+ on<K extends keyof EngineEvents>(event: K, listener: (payload: EngineEvents[K]) => void): () => void;
202
+ setLocale(locale: LocaleType): void;
203
+ getLocale(): LocaleType;
204
+ setTheme(theme: 'dark' | 'light'): void;
205
+ setCustomTheme(theme: ThemeConfig): void;
206
+ private init;
207
+ private updateTheme;
208
+ destroy(): void;
209
+ }
210
+
211
+ /**
212
+ * 树节点类
213
+ * 负责渲染单个节点、处理交互和递归
214
+ */
215
+ declare class BimTreeNode {
216
+ config: TreeNodeConfig;
217
+ element: HTMLElement;
218
+ children: BimTreeNode[];
219
+ parent: BimTreeNode | null;
220
+ checkState: TreeNodeCheckState;
221
+ private contentEl;
222
+ private switcherEl;
223
+ private checkboxEl;
224
+ private titleEl;
225
+ private actionsEl;
226
+ private childrenContainer;
227
+ private onExpandChange;
228
+ private onCheckChange;
229
+ private onNodeClick;
230
+ private renderActions?;
231
+ constructor(config: TreeNodeConfig, options: TreeOptions, callbacks: {
232
+ onExpand: (n: BimTreeNode) => void;
233
+ onCheck: (n: BimTreeNode) => void;
234
+ onClick: (n: BimTreeNode) => void;
235
+ });
236
+ /**
237
+ * 创建节点 DOM
238
+ */
239
+ private createDom;
240
+ /**
241
+ * 设置高亮选中状态 (Select 模式下)
242
+ */
243
+ setSelected(selected: boolean): void;
244
+ /**
245
+ * 更新显示文本 (国际化支持) -> 移除国际化,直接显示
246
+ */
247
+ updateLabel(): void;
248
+ /**
249
+ * 切换展开状态
250
+ */
251
+ toggleExpand(force?: boolean): void;
252
+ /**
253
+ * 切换选中状态 (用户点击)
254
+ */
255
+ toggleCheck(): void;
256
+ /**
257
+ * 设置选中状态 (API调用或联动)
258
+ * @param state 新状态
259
+ * @param fireEvent 是否触发事件
260
+ */
261
+ setChecked(state: TreeNodeCheckState, fireEvent?: boolean): void;
262
+ /**
263
+ * 更新复选框 UI 样式
264
+ */
265
+ updateCheckboxUI(): void;
266
+ /**
267
+ * 添加子节点实例
268
+ */
269
+ appendChild(childNode: BimTreeNode): void;
270
+ /**
271
+ * 销毁
272
+ */
273
+ destroy(): void;
274
+ }
275
+
276
+ /** 按钮内部文字图标排列 */
277
+ declare type ButtonAlign = 'vertical' | 'horizontal';
278
+
279
+ /** 按钮配置 */
280
+ export declare interface ButtonConfig {
281
+ id: string;
282
+ type: ButtonType;
283
+ label: string;
284
+ icon?: string;
285
+ keepActive?: boolean;
286
+ /**
287
+ * 是否互斥(开关互斥)
288
+ *
289
+ * 行为说明:
290
+ * - 当按钮从“未激活”切换到“激活”时,如果该按钮开启了 exclusive,
291
+ * 会自动关闭同互斥范围内的其它已激活按钮,并触发它们的 onClick(用于执行关闭逻辑)。
292
+ * - 一级按钮:互斥范围 = 同 groupId 下的一级按钮
293
+ * - 二级按钮:互斥范围 = 同 groupId 且同 parentId 下的二级按钮
294
+ *
295
+ * 注意:该能力通常与 keepActive 搭配使用。
296
+ */
297
+ exclusive?: boolean;
298
+ isActive?: boolean;
299
+ disabled?: boolean;
300
+ onClick?: (button: OptButton) => void;
301
+ children?: ButtonConfig[];
302
+ groupId?: string;
303
+ parentId?: string;
304
+ /** 按钮内部图标文字排列 (默认 vertical,即图标在上) */
305
+ align?: ButtonAlign;
306
+ /** 图标大小 (正方形,单位 px,默认 32) */
307
+ iconSize?: number;
308
+ /** 按钮最小宽度 (单位 px,默认 50) */
309
+ minWidth?: number;
310
+ }
311
+
312
+ declare interface ButtonGroupColors {
313
+ backgroundColor?: string;
314
+ btnBackgroundColor?: string;
315
+ btnHoverColor?: string;
316
+ btnActiveColor?: string;
317
+ iconColor?: string;
318
+ iconActiveColor?: string;
319
+ textColor?: string;
320
+ textActiveColor?: string;
321
+ }
322
+
323
+ /**
324
+ * 通用按钮组管理器 (ButtonGroupManager)
325
+ * 负责创建和管理通用的按钮组实例。
326
+ */
327
+ declare class ButtonGroupManager extends BimComponent {
328
+ private groups;
329
+ private container;
330
+ constructor(engine: BimEngine, container: HTMLElement);
331
+ create(id: string, options: Omit<ButtonGroupOptions, 'container'>): BimButtonGroup;
332
+ get(id: string): BimButtonGroup | undefined;
333
+ updateTheme(theme: ThemeConfig): void;
334
+ destroy(): void;
335
+ }
336
+
337
+ export declare interface ButtonGroupOptions extends ButtonGroupColors {
338
+ container: HTMLElement | string;
339
+ /** 屏幕位置 (如 top-left) */
340
+ position?: GroupPosition;
341
+ /** 按钮组排列方向 (默认 row) */
342
+ direction?: GroupDirection;
343
+ /** 按钮内部图标文字排列 (默认 vertical) */
344
+ align?: ButtonAlign;
345
+ /** 菜单展开方向 */
346
+ expand?: ExpandDirection;
347
+ showLabel?: boolean;
348
+ visibility?: Record<string, boolean>;
349
+ className?: string;
350
+ }
351
+
352
+ declare type ButtonType = 'button' | 'menu';
353
+
354
+ /**
355
+ * 角色模型类型
356
+ */
357
+ declare type CharacterModel = 'office-male' | 'construction-worker';
358
+
359
+ export declare interface CollapseItemConfig {
360
+ /** 唯一标识符 */
361
+ id: string;
362
+ /** 标题文本的翻译键 (例如 'panel.attributes') */
363
+ title: string;
364
+ /** 内容: HTML字符串 或 HTMLElement */
365
+ content: string | HTMLElement;
366
+ /** 标题栏左侧图标 (SVG 字符串, 可选) */
367
+ icon?: string;
368
+ /** 标题栏右侧额外内容 (可选) */
369
+ extra?: string | HTMLElement;
370
+ /** 是否禁用 */
371
+ disabled?: boolean;
372
+ /** 自定义类名 */
373
+ className?: string;
374
+ }
375
+
376
+ export declare interface CollapseOptions {
377
+ /** 挂载容器 */
378
+ container: HTMLElement | string;
379
+ /** 面板项列表 */
380
+ items: CollapseItemConfig[];
381
+ /** 是否开启手风琴模式 (默认 false) */
382
+ accordion?: boolean;
383
+ /** 初始展开的面板 ID 列表 */
384
+ activeIds?: string[];
385
+ /** 是否显示边框 (默认 true) */
386
+ bordered?: boolean;
387
+ /** 是否幽灵模式 (默认 false) */
388
+ ghost?: boolean;
389
+ /** 自定义类名 */
390
+ className?: string;
391
+ /** 切换面板时的回调 */
392
+ onChange?: (activeIds: string[]) => void;
393
+ }
394
+
395
+ /**
396
+ * 底部工具栏管理器 (ToolbarManager)
397
+ * 仅负责管理底部工具栏实例。
398
+ */
399
+ declare class ConstructTreeManagerBtn extends BimComponent {
400
+ private toolbar;
401
+ private toolbarContainer;
402
+ private container;
403
+ private dialog;
404
+ constructor(engine: BimEngine, container: HTMLElement);
405
+ private init;
406
+ openConstructTreeDialog(): void;
407
+ refresh(): void;
408
+ destroy(): void;
409
+ addGroup(groupId: string, beforeGroupId?: string): void;
410
+ addButton(config: ButtonConfig): void;
411
+ setButtonVisibility(id: string, v: boolean): void;
412
+ setShowLabel(show: boolean): void;
413
+ setVisible(visible: boolean): void;
414
+ setBackgroundColor(color: string): void;
415
+ setColors(colors: ButtonGroupColors): void;
416
+ }
417
+
418
+ /**
419
+ * 描述列表项配置
420
+ */
421
+ export declare interface DescriptionItem {
422
+ /** 标签文本 (直接显示,组件内部不翻译) */
423
+ label: string;
424
+ /** 内容文本或元素 */
425
+ value: string | HTMLElement;
426
+ /** 行级自定义标签颜色 */
427
+ labelColor?: string;
428
+ /** 行级自定义内容颜色 */
429
+ valueColor?: string;
430
+ /** 自定义类名 */
431
+ className?: string;
432
+ }
433
+
434
+ /**
435
+ * 描述列表组件配置
436
+ */
437
+ export declare interface DescriptionOptions {
438
+ /** 挂载容器 */
439
+ container: HTMLElement | string;
440
+ /** 数据项列表 */
441
+ items: DescriptionItem[];
442
+ /**
443
+ * 是否显示边框 (默认 false)
444
+ * 开启后,将显示行间分割线以及 Key-Value 之间的纵向分割线
445
+ */
446
+ bordered?: boolean;
447
+ /** 标签固定宽度 (例如 '80px'),若不设置则自适应 */
448
+ labelWidth?: string;
449
+ /** 全局标签颜色 */
450
+ labelColor?: string;
451
+ /** 全局内容颜色 */
452
+ valueColor?: string;
453
+ /** 全局字体大小 */
454
+ fontSize?: string;
455
+ /** 标签内边距 (默认 '0 4px') */
456
+ labelPadding?: string;
457
+ /** 内容内边距 (默认 '0 4px') */
458
+ valuePadding?: string;
459
+ /** 自定义类名 */
460
+ className?: string;
461
+ }
462
+
463
+ /**
464
+ * 弹窗颜色配置
465
+ */
466
+ declare interface DialogColors {
467
+ /** 窗体背景颜色,默认 rgba(17, 17, 17, 0.95) */
468
+ backgroundColor?: string;
469
+ /** 标题栏背景颜色,默认 #2a2a2a */
470
+ headerBackgroundColor?: string;
471
+ /** 标题文字颜色,默认 #fff */
472
+ titleColor?: string;
473
+ /** 内容文字颜色,默认 #ccc */
474
+ textColor?: string;
475
+ /** 边框颜色,默认 #444 */
476
+ borderColor?: string;
477
+ }
478
+
479
+ /**
480
+ * 弹窗管理器
481
+ * 负责创建和管理应用中的各类弹窗。
482
+ */
483
+ declare class DialogManager extends BimComponent {
484
+ /** 弹窗挂载的父容器 */
485
+ private container;
486
+ /** 活跃的弹窗实例列表 */
487
+ private activeDialogs;
488
+ /**
489
+ * 构造函数
490
+ * @param engine 引擎实例
491
+ * @param container 弹窗挂载的目标容器
492
+ */
493
+ constructor(engine: BimEngine, container: HTMLElement);
494
+ /**
495
+ * 创建一个通用弹窗
496
+ * @param options 弹窗配置选项(不需要传 container,自动使用管理器绑定的容器)
497
+ * @returns BimDialog 实例
498
+ */
499
+ create(options: Omit<DialogOptions, 'container'>): BimDialog;
500
+ /**
501
+ * 显示二次封装的模型信息弹窗
502
+ * 演示如何调用特定的业务弹窗组件
503
+ */
504
+ showInfoDialog(): void;
505
+ /**
506
+ * 响应全局主题变更
507
+ * @param theme 全局主题配置
508
+ */
509
+ updateTheme(theme: ThemeConfig): void;
510
+ destroy(): void;
511
+ }
512
+
513
+ /**
514
+ * 弹窗配置选项接口
515
+ */
516
+ export declare interface DialogOptions extends DialogColors {
517
+ /** 弹窗挂载的父容器 */
518
+ container: HTMLElement;
519
+ /** 弹窗标题 */
520
+ title?: string;
521
+ /** 弹窗内容,支持 HTML 字符串或 HTMLElement */
522
+ content?: HTMLElement | string;
523
+ /** 弹窗宽度,数字(像素)或字符串(如 '50%') */
524
+ width?: number | string;
525
+ /** 弹窗高度 */
526
+ height?: number | string;
527
+ /** 弹窗位置 */
528
+ position?: DialogPosition;
529
+ /** 是否可拖拽 */
530
+ draggable?: boolean;
531
+ /** 是否可调整大小 */
532
+ resizable?: boolean;
533
+ /** 最小宽度限制 */
534
+ minWidth?: number;
535
+ /** 最小高度限制 */
536
+ minHeight?: number;
537
+ /** 关闭时的回调函数 */
538
+ onClose?: () => void;
539
+ /** 打开时的回调函数 */
540
+ onOpen?: () => void;
541
+ /** 弹窗唯一标识 ID (可选) */
542
+ id?: string;
543
+ }
544
+
545
+ /**
546
+ * 弹窗位置类型定义
547
+ * 可以是预设的字符串位置(如 'center', 'top-left' 等),
548
+ * 也可以是具体的坐标对象 { x, y }
549
+ */
550
+ export declare type DialogPosition = 'center' | 'top-left' | 'top-center' | 'top-right' | 'left-center' | 'right-center' | 'bottom-left' | 'bottom-center' | 'bottom-right' | {
551
+ x: number;
552
+ y: number;
553
+ };
554
+
555
+ export declare interface EngineEvents {
556
+ 'ui:open-dialog': {
557
+ id: string;
558
+ data?: any;
559
+ };
560
+ 'ui:close-dialog': {
561
+ id: string;
562
+ };
563
+ 'engine:model-loaded': {
564
+ url: string;
565
+ };
566
+ 'engine:object-clicked': {
567
+ objectId: string;
568
+ position: {
569
+ x: number;
570
+ y: number;
571
+ z: number;
572
+ };
573
+ };
574
+ 'ui:tree-node-check': {
575
+ id: string;
576
+ checked: boolean;
577
+ node: any;
578
+ };
579
+ 'ui:tree-node-select': {
580
+ id: string;
581
+ selected: boolean;
582
+ node: any;
583
+ };
584
+ 'ui:tree-node-expand': {
585
+ id: string;
586
+ expanded: boolean;
587
+ };
588
+ 'ui:collapse-change': {
589
+ activeIds: string[];
590
+ };
591
+ 'sys:theme-changed': {
592
+ theme: string;
593
+ };
594
+ 'sys:locale-changed': {
595
+ locale: string;
596
+ };
597
+ 'walk:path-mode-toggle': {
598
+ isActive: boolean;
599
+ };
600
+ 'walk:walk-mode-toggle': {
601
+ isActive: boolean;
602
+ };
603
+ 'walk:plan-view-toggle': {
604
+ isActive: boolean;
605
+ };
606
+ 'walk:speed-change': {
607
+ speed: number;
608
+ };
609
+ 'walk:gravity-toggle': {
610
+ enabled: boolean;
611
+ };
612
+ 'walk:collision-toggle': {
613
+ enabled: boolean;
614
+ };
615
+ 'map:opened': {};
616
+ 'map:closed': {};
617
+ }
618
+
619
+ /**
620
+ * 3D 引擎管理器
621
+ * 负责连接 Engine 组件和 BimEngine,向外部暴露简化的 API
622
+ * 采用延迟初始化模式,用户需主动调用 initialize() 方法
623
+ */
624
+ declare class EngineManager extends BimComponent {
625
+ /** 3D 引擎挂载的父容器 */
626
+ private container;
627
+ /** 3D 引擎组件实例 */
628
+ private engineInstance;
629
+ rightKey: RightKeyManager | null;
630
+ /**
631
+ * 构造函数
632
+ * @param engine 引擎实例
633
+ * @param container 3D 引擎挂载的目标容器
634
+ */
635
+ constructor(engine: BimEngine, container: HTMLElement);
636
+ /**
637
+ * 初始化 3D 引擎
638
+ * @param options 引擎配置选项(可选,如果不提供则使用默认配置)
639
+ * @returns 是否初始化成功
640
+ */
641
+ initialize(options?: Omit<EngineOptions, 'container'>): boolean;
642
+ /**
643
+ * 检��� 3D 引擎是否已初始化
644
+ */
645
+ isInitialized(): boolean;
646
+ /**
647
+ * 加载 3D 模型
648
+ * @param url 模型文件 URL
649
+ * @param options 加载选项(位置、旋转、缩放)
650
+ */
651
+ loadModel(url: string, options?: ModelLoadOptions): void;
652
+ /**
653
+ * 获取原始 3D 引擎实例
654
+ * 用于直接调用第三方引擎的其他 API
655
+ */
656
+ getEngine(): any;
657
+ /**
658
+ * 回到主视角
659
+ */
660
+ CameraGoHome(): void;
661
+ /**
662
+ * 激活测量功能
663
+ * @param mode 测量类型
664
+ */
665
+ activateMeasure(mode: MeasureMode): void;
666
+ /**
667
+ * 停用测量功能
668
+ */
669
+ deactivateMeasure(): void;
670
+ /**
671
+ * 获取当前激活的测量类型
672
+ */
673
+ getCurrentMeasureType(): MeasureMode | null;
674
+ /**
675
+ * 销毁 3D 引擎实例
676
+ */
677
+ destroy(): void;
678
+ }
679
+
680
+ /**
681
+ * 引擎配置选项
682
+ * 用于 Engine 组件的初始化
683
+ */
684
+ export declare interface EngineOptions {
685
+ /** 容器元素 */
686
+ container: HTMLElement;
687
+ /** 背景颜色(十六进制数字如 0x333333,或 CSS 字符串如 'linear-gradient(...)') */
688
+ backgroundColor?: number | string;
689
+ /** WebGL 版本 */
690
+ version?: 'v1' | 'v2';
691
+ /** 是否显示性能统计 */
692
+ showStats?: boolean;
693
+ /** 是否显示视图立方体 */
694
+ showViewCube?: boolean;
695
+ }
696
+
697
+ declare class EventEmitter {
698
+ private events;
699
+ on(event: string, listener: Listener): () => void;
700
+ off(event: string, listener: Listener): void;
701
+ emit(event: string, payload?: any): void;
702
+ clear(): void;
703
+ }
704
+
705
+ /** 二级菜单展开方向 */
706
+ declare type ExpandDirection = 'up' | 'down' | 'left' | 'right';
707
+
708
+ /** 按钮组排列方向 (Flex-direction) */
709
+ declare type GroupDirection = 'row' | 'column';
710
+
711
+ /** 弹窗/按钮组位置 */
712
+ declare type GroupPosition = 'center' | 'top-left' | 'top-center' | 'top-right' | 'left-center' | 'right-center' | 'bottom-left' | 'bottom-center' | 'bottom-right' | {
713
+ x: number;
714
+ y: number;
715
+ } | 'static';
716
+
717
+ /**
718
+ * BIM 引擎组件通用接口
719
+ * 所有受引擎管理的 UI 组件都必须实现此接口
720
+ */
721
+ export declare interface IBimComponent {
722
+ /**
723
+ * 初始化组件
724
+ * 用于创建 DOM、绑定事件、加载资源等
725
+ * 支持同步或异步操作
726
+ */
727
+ init(): void | Promise<void>;
728
+ /**
729
+ * 设置主题
730
+ * 组件应在此方法中将 ThemeConfig 映射为自身的 CSS 变量或样式
731
+ */
732
+ setTheme(theme: ThemeConfig): void;
733
+ /**
734
+ * 设置语言
735
+ */
736
+ setLocales(): void;
737
+ /**
738
+ * 销毁组件
739
+ * 清理 DOM 事件监听、定时器和引用
740
+ */
741
+ destroy(): void;
742
+ }
743
+
744
+ declare type Listener<T = any> = (payload: T) => void;
745
+
746
+ /**
747
+ * 语言��码类型
748
+ */
749
+ declare type LocaleType = 'zh-CN' | 'en-US';
750
+
751
+ /**
752
+ * 地图弹窗管理器(独立通用组件)
753
+ */
754
+ declare class MapDialogManager extends BimComponent {
755
+ private dialogId;
756
+ private dialog;
757
+ private panel;
758
+ constructor(engine: BimEngine);
759
+ init(): void;
760
+ /**
761
+ * 显示弹窗
762
+ */
763
+ show(): void;
764
+ /**
765
+ * 隐藏弹窗
766
+ */
767
+ hide(): void;
768
+ /**
769
+ * 检查地图是否打开
770
+ */
771
+ isOpen(): boolean;
772
+ /**
773
+ * 销毁弹窗和面板
774
+ */
775
+ destroy(): void;
776
+ }
777
+
778
+ /**
779
+ * 测量配置项(由组件内部维护默认值,并读取/写入缓存)
780
+ */
781
+ declare interface MeasureConfig {
782
+ unit: MeasureUnit;
783
+ precision: MeasurePrecision;
784
+ }
785
+
786
+ /**
787
+ * 测量弹窗管理器
788
+ */
789
+ declare class MeasureDialogManager extends BimComponent {
790
+ private dialogId;
791
+ private dialog;
792
+ private panel;
793
+ /**
794
+ * 测量配置项(单位/精度)
795
+ * 说明:MeasurePanel 会自行从缓存加载默认配置,Manager 这里只做“对外读取/设置”的镜像。
796
+ */
797
+ private config;
798
+ constructor(engine: BimEngine);
799
+ init(): void;
800
+ /**
801
+ * 显示测量弹窗
802
+ */
803
+ show(): void;
804
+ /**
805
+ * 获取当前测量方式
806
+ * 说明:如果面板未创建,则返回 null
807
+ */
808
+ getActiveMode(): MeasureMode | null;
809
+ /**
810
+ * 切换测量方式(你要求的“切换类型的方法”)
811
+ * @param mode 测量方式
812
+ */
813
+ switchMode(mode: MeasureMode): void;
814
+ /**
815
+ * 设置测量结果(推荐使用的新方法名)
816
+ * 说明:内部直接调用 MeasurePanel.setResult()
817
+ * @param result 测量结果;传 null 表示清空
818
+ */
819
+ setMeasureResult(result: MeasureResult | null): void;
820
+ /**
821
+ * 获取测量配置(单位/精度)
822
+ * - 如果面板存在:返回面板当前配置
823
+ * - 否则:返回 Manager 缓存的最后一次配置(可能为 null)
824
+ */
825
+ getConfig(): MeasureConfig | null;
826
+ /**
827
+ * 设置测量配置(单位/精度)
828
+ * @param partial 部分更新
829
+ * @param persist 是否写入缓存(默认 true)
830
+ */
831
+ setConfig(partial: Partial<MeasureConfig>, persist?: boolean): void;
832
+ /**
833
+ * 删除全部(仅清空 UI;真实测量清理逻辑后续再接)
834
+ */
835
+ clearAll(): void;
836
+ /**
837
+ * 打开设置(仅预留方法/回调)
838
+ */
839
+ openSettings(): void;
840
+ destroy(): void;
841
+ }
842
+
843
+ /**
844
+ * 测量相关的通用类型定义
845
+ *
846
+ * 说明:
847
+ * - 这些类型定义在通用 types 目录下,避免组件间直接耦合
848
+ * - Engine 组件、MeasurePanel 组件、Manager 都可以引用这些类型
849
+ */
850
+ /**
851
+ * 测量方式(8 种)
852
+ *
853
+ * 说明:
854
+ * - id 采用英文驼峰/小写,便于程序内部使用
855
+ * - 显示名称必须通过国际化 key 获取(见 locales)
856
+ */
857
+ declare type MeasureMode = 'distance' | 'minDistance' | 'angle' | 'elevation' | 'volume' | 'laserDistance' | 'slope' | 'spaceVolume';
858
+
859
+ /**
860
+ * 精度(小数位数)
861
+ * - 0 -> 0
862
+ * - 1 -> 0.0
863
+ * - 2 -> 0.00
864
+ * - 3 -> 0.000
865
+ */
866
+ declare type MeasurePrecision = 0 | 1 | 2 | 3;
867
+
868
+ /**
869
+ * 测量结果数据
870
+ *
871
+ * 说明:
872
+ * - 真实测量未实现,因此结果由外部通过 setResult 传入。
873
+ * - 不同测量方式对应不同字段;未传入则 UI 显示 “--”。
874
+ */
875
+ declare interface MeasureResult {
876
+ /** 距离(单位:mm) */
877
+ distanceMm?: number;
878
+ /** 最小距离(单位:mm) */
879
+ minDistanceMm?: number;
880
+ /** 角度(单位:deg) */
881
+ angleDeg?: number;
882
+ /** 标高(单位:mm) */
883
+ elevationMm?: number;
884
+ /** 体积(单位:m³) */
885
+ volumeM3?: number;
886
+ /** 激光测距(单位:mm) */
887
+ laserDistanceMm?: number;
888
+ /** 坡度(单位:%) */
889
+ slopePercent?: number;
890
+ /** 空间体积(单位:m³) */
891
+ spaceVolumeM3?: number;
892
+ /** 可选:展示测量点/结果点坐标(单位由引擎侧定义,这里只负责显示) */
893
+ xyz?: MeasureXYZ;
894
+ }
895
+
896
+ /**
897
+ * 距离/标高等“长度类”单位
898
+ */
899
+ declare type MeasureUnit = 'm' | 'cm' | 'mm' | 'km';
900
+
901
+ /**
902
+ * 3D 坐标(可选展示)
903
+ */
904
+ declare interface MeasureXYZ {
905
+ x: number;
906
+ y: number;
907
+ z: number;
908
+ }
909
+
910
+ /**
911
+ * 菜单项配置接口 (用于简化的对象配置)
912
+ */
913
+ declare interface MenuItemConfig {
914
+ id: string;
915
+ label: string;
916
+ onClick?: () => void;
917
+ icon?: string;
918
+ group?: string;
919
+ order?: number;
920
+ children?: MenuItemConfig[];
921
+ disabled?: boolean;
922
+ visible?: boolean;
923
+ }
924
+
925
+ /**
926
+ * 模型加载选项
927
+ * 用于配置模型的位置、旋转和缩放
928
+ */
929
+ export declare interface ModelLoadOptions {
930
+ /** 模型初始位置 [x, y, z] */
931
+ position?: [number, number, number];
932
+ /** 模型初始旋转 [x, y, z](弧度) */
933
+ rotation?: [number, number, number];
934
+ /** 模型初始缩放 [x, y, z] */
935
+ scale?: [number, number, number];
936
+ /** 模型 ID(可选,如果不提供则自动生成) */
937
+ id?: string;
938
+ }
939
+
940
+ /**
941
+ * 节点点击行为类型
942
+ */
943
+ export declare type NodeClickAction = 'select' | 'expand';
944
+
945
+ declare interface OptButton extends ButtonConfig {
946
+ children?: OptButton[];
947
+ }
948
+
949
+ /**
950
+ * 属性面板管理器
951
+ * 负责展示和管理属性面板弹窗 (演示 Tab + Collapse + Description 组件)
952
+ */
953
+ declare class PropertyPanelManager extends BimComponent {
954
+ private dialogId;
955
+ private dialog;
956
+ constructor(engine: BimEngine);
957
+ init(): void;
958
+ /**
959
+ * 显示属性面板
960
+ */
961
+ show(): void;
962
+ /**
963
+ * 创建"属性"标签页的内容 (包含 Collapse)
964
+ */
965
+ private createPropsTabContent;
966
+ /**
967
+ * 创建"材质"标签页的内容 (包含 Collapse)
968
+ */
969
+ private createMaterialTabContent;
970
+ private createBaseInfoContent;
971
+ private createAdvancedInfoContent;
972
+ private createMaterialContent;
973
+ /**
974
+ * 检查属性面板是否打开
975
+ */
976
+ isOpen(): boolean;
977
+ /**
978
+ * 隐藏属性面板
979
+ */
980
+ hide(): void;
981
+ destroy(): void;
982
+ }
983
+
984
+ /**
985
+ * 右键菜单管理器 (RightKeyManager)
986
+ * 负责协调右键交互流程:
987
+ * 1. 监听 Canvas/容器的 contextmenu 事件
988
+ * 2. 通过注册的处理器 (Handler) 获取需要显示的菜单项
989
+ * 3. 实例化 Menu 组件并装载到 RightKey 容器中显示
990
+ */
991
+ declare class RightKeyManager extends BimComponent {
992
+ private container;
993
+ private rightKeyPanel;
994
+ private contextHandlers;
995
+ constructor(engine: BimEngine, container: HTMLElement);
996
+ destroy(): void;
997
+ /**
998
+ * 注册上下文菜单处理器
999
+ * @param handler 处理函数,接收鼠标事件,返回菜单项数组
1000
+ */
1001
+ registerHandler(handler: (e: MouseEvent) => MenuItemConfig[] | null): void;
1002
+ /**
1003
+ * 手动显示菜单
1004
+ * 允许外部直接调用以显示特定的菜单,不一定依赖右键事件
1005
+ * @param x 屏幕 X 坐标
1006
+ * @param y 屏幕 Y 坐标
1007
+ * @param items 菜单项列表
1008
+ * @param groupOrder 可选的分组顺序
1009
+ */
1010
+ showMenu(x: number, y: number, items: MenuItemConfig[], groupOrder?: string[]): void;
1011
+ /**
1012
+ * 隐藏右键菜单
1013
+ */
1014
+ hide(): void;
1015
+ /**
1016
+ * 处理右键点击事件
1017
+ * 由 BimRightKey 组件在检测到有效右键点击时调用
1018
+ */
1019
+ private handleContextMenu;
1020
+ }
1021
+
1022
+ /**
1023
+ * 轴向类型
1024
+ */
1025
+ declare type SectionAxis = 'x' | 'y' | 'z';
1026
+
1027
+ /**
1028
+ * 轴向剖切弹窗管理器
1029
+ */
1030
+ declare class SectionAxisDialogManager extends BimComponent {
1031
+ private dialogId;
1032
+ private dialog;
1033
+ private panel;
1034
+ constructor(engine: BimEngine);
1035
+ init(): void;
1036
+ /**
1037
+ * 显示弹窗
1038
+ */
1039
+ show(): void;
1040
+ /**
1041
+ * 隐藏弹窗
1042
+ */
1043
+ hide(): void;
1044
+ /**
1045
+ * 获取隐藏状态
1046
+ */
1047
+ getHiddenState(): boolean;
1048
+ /**
1049
+ * 设置隐藏状态
1050
+ */
1051
+ setHiddenState(isHidden: boolean): void;
1052
+ /**
1053
+ * 获取当前激活的轴向
1054
+ */
1055
+ getActiveAxis(): SectionAxis;
1056
+ /**
1057
+ * 设置激活的轴向
1058
+ */
1059
+ setActiveAxis(axis: SectionAxis): void;
1060
+ /**
1061
+ * 销毁弹窗和面板
1062
+ */
1063
+ destroy(): void;
1064
+ }
1065
+
1066
+ /**
1067
+ * 剖切盒轴向范围
1068
+ */
1069
+ declare interface SectionBoxAxisRange {
1070
+ /** 最小值(0-100的百分比) */
1071
+ min: number;
1072
+ /** 最大值(0-100的百分比) */
1073
+ max: number;
1074
+ }
1075
+
1076
+ /**
1077
+ * 剖切盒弹窗管理器
1078
+ */
1079
+ declare class SectionBoxDialogManager extends BimComponent {
1080
+ private dialogId;
1081
+ private dialog;
1082
+ private panel;
1083
+ constructor(engine: BimEngine);
1084
+ init(): void;
1085
+ /**
1086
+ * 显示弹窗
1087
+ */
1088
+ show(): void;
1089
+ /**
1090
+ * 隐藏弹窗
1091
+ */
1092
+ hide(): void;
1093
+ /**
1094
+ * 获取隐藏状态
1095
+ */
1096
+ getHiddenState(): boolean;
1097
+ /**
1098
+ * 设置隐藏状态
1099
+ */
1100
+ setHiddenState(isHidden: boolean): void;
1101
+ /**
1102
+ * 获取反向状态
1103
+ */
1104
+ getReversedState(): boolean;
1105
+ /**
1106
+ * 设置反向状态
1107
+ */
1108
+ setReversedState(isReversed: boolean): void;
1109
+ /**
1110
+ * 获取范围值
1111
+ */
1112
+ getRange(): SectionBoxRange | null;
1113
+ /**
1114
+ * 设置范围值
1115
+ */
1116
+ setRange(range: Partial<SectionBoxRange>): void;
1117
+ /**
1118
+ * 销毁弹窗和面板
1119
+ */
1120
+ destroy(): void;
1121
+ }
1122
+
1123
+ /**
1124
+ * 剖切盒范围数据
1125
+ */
1126
+ declare interface SectionBoxRange {
1127
+ /** X轴范围 */
1128
+ x: SectionBoxAxisRange;
1129
+ /** Y轴范围 */
1130
+ y: SectionBoxAxisRange;
1131
+ /** Z轴范围 */
1132
+ z: SectionBoxAxisRange;
1133
+ }
1134
+
1135
+ /**
1136
+ * 拾取面剖切弹窗管理器
1137
+ */
1138
+ declare class SectionPlaneDialogManager extends BimComponent {
1139
+ private dialogId;
1140
+ private dialog;
1141
+ private panel;
1142
+ constructor(engine: BimEngine);
1143
+ init(): void;
1144
+ /**
1145
+ * 显示拾取面剖切弹窗
1146
+ */
1147
+ show(): void;
1148
+ /**
1149
+ * 隐藏弹窗
1150
+ */
1151
+ hide(): void;
1152
+ /**
1153
+ * 销毁弹窗
1154
+ */
1155
+ destroy(): void;
1156
+ }
1157
+
1158
+ /**
1159
+ * 全局主题配置接口
1160
+ * 定义系统通用的语义化颜色
1161
+ */
1162
+ export declare interface ThemeConfig {
1163
+ /** 主题名称 */
1164
+ name: string;
1165
+ /** 品牌色/主色 */
1166
+ primary: string;
1167
+ /** 主色悬停/激活态 */
1168
+ primaryHover: string;
1169
+ /** 基础背景色 (应用整体背景) */
1170
+ background: string;
1171
+ /** 面板背景色 (工具栏、弹窗背景) */
1172
+ panelBackground: string;
1173
+ /** 主要文字颜色 */
1174
+ textPrimary: string;
1175
+ /** 次要文字颜色 */
1176
+ textSecondary: string;
1177
+ /** 边框/分割线颜色 */
1178
+ border: string;
1179
+ /** 图标默认颜色 */
1180
+ icon: string;
1181
+ /** 图标激活颜色 */
1182
+ iconActive: string;
1183
+ /** 交互组件背景 (如按钮默认背景) */
1184
+ componentBackground: string;
1185
+ /** 交互组件悬停背景 */
1186
+ componentHover: string;
1187
+ /** 交互组件激活背景 */
1188
+ componentActive: string;
1189
+ }
1190
+
1191
+ /**
1192
+ * 主题类型定义
1193
+ */
1194
+ export declare type ThemeType = 'dark' | 'light' | 'custom';
1195
+
1196
+ /**
1197
+ * 底部工具栏管理器 (ToolbarManager)
1198
+ * 仅负责管理底部工具栏实例。
1199
+ */
1200
+ declare class ToolbarManager extends BimComponent {
1201
+ private toolbar;
1202
+ private toolbarContainer;
1203
+ private container;
1204
+ constructor(engine: BimEngine, container: HTMLElement);
1205
+ private init;
1206
+ updateTheme(theme: ThemeConfig): void;
1207
+ refresh(): void;
1208
+ destroy(): void;
1209
+ addGroup(groupId: string, beforeGroupId?: string): void;
1210
+ addButton(config: ButtonConfig): void;
1211
+ setButtonVisibility(id: string, v: boolean): void;
1212
+ setShowLabel(show: boolean): void;
1213
+ setBtnActive(id: string, active?: boolean): void;
1214
+ setVisible(visible: boolean): void;
1215
+ setBackgroundColor(color: string): void;
1216
+ setColors(colors: ButtonGroupColors): void;
1217
+ /**
1218
+ * 隐藏工具栏
1219
+ */
1220
+ hide(): void;
1221
+ /**
1222
+ * 显示工具栏
1223
+ */
1224
+ show(): void;
1225
+ /**
1226
+ * 获取工具栏容器
1227
+ */
1228
+ getContainer(): HTMLElement | null;
1229
+ }
1230
+
1231
+ /**
1232
+ * 节点勾选状态枚举
1233
+ */
1234
+ export declare enum TreeNodeCheckState {
1235
+ Unchecked = 0,
1236
+ Checked = 1,
1237
+ Indeterminate = 2
1238
+ }
1239
+
1240
+ /**
1241
+ * 树节点配置接口
1242
+ */
1243
+ export declare interface TreeNodeConfig {
1244
+ /** 唯一标识符 */
1245
+ id: string;
1246
+ /** 显示文本的翻译键 */
1247
+ label: string;
1248
+ /** 节点图标 (SVG string 或 URL) */
1249
+ icon?: string;
1250
+ /** 子节点列表 */
1251
+ children?: TreeNodeConfig[];
1252
+ /** 初始展开状态 (默认 false) */
1253
+ expanded?: boolean;
1254
+ /** 初始选中状态 (默认 false) */
1255
+ checked?: boolean;
1256
+ /** 是否禁用 (默认 false) */
1257
+ disabled?: boolean;
1258
+ /** 自定义业务数据 */
1259
+ data?: any;
1260
+ /** 是否是叶子节点 (用于异步加载场景,暂留接口) */
1261
+ isLeaf?: boolean;
1262
+ /** 点击整行的行为 (默认 'select') */
1263
+ clickAction?: NodeClickAction;
1264
+ }
1265
+
1266
+ /**
1267
+ * 树组件配置选项
1268
+ */
1269
+ export declare interface TreeOptions {
1270
+ /** 树的数据源 */
1271
+ data: TreeNodeConfig[];
1272
+ /** 是否显示复选框 (默认 true) */
1273
+ checkable?: boolean;
1274
+ /**
1275
+ * 父子节点选中状态是否关联 (默认 true)
1276
+ * true: 选中父选子,子全选自动选父
1277
+ * false: 独立选中
1278
+ */
1279
+ checkStrictly?: boolean;
1280
+ /** 默认展开所有节点 (默认 false) */
1281
+ defaultExpandAll?: boolean;
1282
+ /** 缩进宽度 (像素,默认 24) */
1283
+ indent?: number;
1284
+ /** 是否启用搜索功能 (默认 false) */
1285
+ enableSearch?: boolean;
1286
+ /** 搜索框占位符 */
1287
+ searchPlaceholder?: string;
1288
+ /** 节点勾选回调 */
1289
+ onNodeCheck?: (node: BimTreeNode) => void;
1290
+ /** 节点选择回调 */
1291
+ onNodeSelect?: (node: BimTreeNode) => void;
1292
+ /** 节点展开/折叠回调 */
1293
+ onNodeExpand?: (node: BimTreeNode) => void;
1294
+ /**
1295
+ * 选中时显示的自定义操作栏渲染函数
1296
+ * 返回 HTML 字符串或 HTMLElement
1297
+ */
1298
+ renderActions?: (node: TreeNodeConfig) => HTMLElement | string;
1299
+ }
1300
+
1301
+ /**
1302
+ * 漫游控制管理器
1303
+ */
1304
+ declare class WalkControlManager extends BimComponent {
1305
+ panel: WalkControlPanel | null;
1306
+ private pathManager;
1307
+ constructor(engine: BimEngine);
1308
+ init(): void;
1309
+ /**
1310
+ * 显示漫游控制面板
1311
+ */
1312
+ show(): void;
1313
+ /**
1314
+ * 隐藏漫游控制面板
1315
+ */
1316
+ hide(): void;
1317
+ /**
1318
+ * 销毁管理器
1319
+ */
1320
+ destroy(): void;
1321
+ }
1322
+
1323
+ /**
1324
+ * 漫游控制模式
1325
+ */
1326
+ declare type WalkControlMode = 'none' | 'path' | 'walk';
1327
+
1328
+ declare class WalkControlPanel implements IBimComponent {
1329
+ element: HTMLElement;
1330
+ private options;
1331
+ private state;
1332
+ private planViewBtn;
1333
+ private pathModeBtn;
1334
+ private walkModeBtn;
1335
+ private settingsContainer;
1336
+ private speedControl;
1337
+ private speedDecreaseBtn;
1338
+ private speedIncreaseBtn;
1339
+ private speedDisplay;
1340
+ private gravityCheckbox;
1341
+ private gravityLabel;
1342
+ private collisionCheckbox;
1343
+ private collisionLabel;
1344
+ private characterModelSelect;
1345
+ private characterModelLabel;
1346
+ private walkModeSelect;
1347
+ private walkModeLabel;
1348
+ private exitBtn;
1349
+ private unsubscribeLocale;
1350
+ private unsubscribeTheme;
1351
+ constructor(options?: WalkControlPanelOptions);
1352
+ init(): void;
1353
+ setPlanViewActive(active: boolean): void;
1354
+ setPathModeActive(active: boolean): void;
1355
+ getState(): WalkControlState;
1356
+ private createPanel;
1357
+ private createLeftButtons;
1358
+ private createSettingsContainer;
1359
+ private createSpeedControl;
1360
+ private createIconButton;
1361
+ private createExitButton;
1362
+ private setMode;
1363
+ private updateButtonStates;
1364
+ private updateSettingsView;
1365
+ private updateSpeedDisplay;
1366
+ private updateSpeedButtonStates;
1367
+ private getIconSVG;
1368
+ setLocales(): void;
1369
+ setTheme(theme: ThemeConfig): void;
1370
+ destroy(): void;
1371
+ }
1372
+
1373
+ /**
1374
+ * 漫游控制面板配置选项
1375
+ */
1376
+ declare interface WalkControlPanelOptions {
1377
+ /** 平面图切换回调 */
1378
+ onPlanViewToggle?: (isActive: boolean) => void;
1379
+ /** 路径漫游模式切换回调 */
1380
+ onPathModeToggle?: (isActive: boolean) => void;
1381
+ /** 漫游模式切换回调 */
1382
+ onWalkModeToggle?: (isActive: boolean) => void;
1383
+ /** 速度变化回调 */
1384
+ onSpeedChange?: (speed: number) => void;
1385
+ /** 重力切换回调 */
1386
+ onGravityToggle?: (enabled: boolean) => void;
1387
+ /** 碰撞切换回调 */
1388
+ onCollisionToggle?: (enabled: boolean) => void;
1389
+ /** 角色模型变化回调 */
1390
+ onCharacterModelChange?: (model: CharacterModel) => void;
1391
+ /** 行走模式变化回调 */
1392
+ onWalkModeChange?: (mode: WalkMode) => void;
1393
+ /** 退出回调 */
1394
+ onExit?: () => void;
1395
+ /** 默认速度 (0-100) */
1396
+ defaultSpeed?: number;
1397
+ /** 默认重力状态 */
1398
+ defaultGravity?: boolean;
1399
+ /** 默认碰撞状态 */
1400
+ defaultCollision?: boolean;
1401
+ /** 默认角色模型 */
1402
+ defaultCharacterModel?: CharacterModel;
1403
+ /** 默认行走模式 */
1404
+ defaultWalkMode?: WalkMode;
1405
+ }
1406
+
1407
+ /**
1408
+ * 漫游控制状态
1409
+ */
1410
+ declare interface WalkControlState {
1411
+ /** 当前模式 */
1412
+ mode: WalkControlMode;
1413
+ /** 平面图是否激活 */
1414
+ isPlanViewActive: boolean;
1415
+ /** 移动速度 (0-100) */
1416
+ speed: number;
1417
+ /** 重力是否启用 */
1418
+ gravity: boolean;
1419
+ /** 碰撞是否启用 */
1420
+ collision: boolean;
1421
+ /** 当前角色模型 */
1422
+ characterModel: CharacterModel;
1423
+ /** 当前行走模式 */
1424
+ walkMode: WalkMode;
1425
+ }
1426
+
1427
+ /**
1428
+ * 行走模式类型
1429
+ */
1430
+ declare type WalkMode = 'walk' | 'run';
1431
+
1432
+ export { }