feat(registry): 注册 ComponentDetailManager 到全局 Registry 和 BimEngine
This commit is contained in:
@@ -62,7 +62,6 @@ export class EngineManager extends BaseManager {
|
||||
group: 'component',
|
||||
onClick: () => {
|
||||
const registry = ManagerRegistry.getInstance();
|
||||
// @ts-expect-error - componentDetail will be added in Task 4
|
||||
registry.componentDetail?.show(selected.url, selected.id);
|
||||
this.rightKey?.hide();
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ export class MeasureDialogManager extends BaseDialogManager {
|
||||
},
|
||||
onClearAll: () => {
|
||||
console.log('[MeasureDialogManager] 删除全部');
|
||||
this.registry.engine3d?.clearAllMeasures();
|
||||
},
|
||||
onSettings: () => {
|
||||
console.log('[MeasureDialogManager] 打开设置');
|
||||
|
||||
@@ -57,27 +57,30 @@ export class SectionBoxDialogManager extends BaseDialogManager {
|
||||
defaultHidden: false,
|
||||
defaultReversed: false,
|
||||
onHideToggle: (isHidden) => {
|
||||
console.log('[SectionBoxDialogManager] 隐藏切换:', isHidden);
|
||||
// 底层暂不支持隐藏功能
|
||||
console.log('[SectionBoxDialogManager] 隐藏切换(底层暂不支持):', isHidden);
|
||||
},
|
||||
onReverseToggle: (isReversed) => {
|
||||
console.log('[SectionBoxDialogManager] 反向切换:', isReversed);
|
||||
// 底层暂不支持反向功能
|
||||
console.log('[SectionBoxDialogManager] 反向切换(底层暂不支持):', isReversed);
|
||||
},
|
||||
onFitToModel: () => {
|
||||
console.log('[SectionBoxDialogManager] 适应到模型');
|
||||
this.registry.engine3d?.fitSectionBoxToModel();
|
||||
},
|
||||
onReset: () => {
|
||||
console.log('[SectionBoxDialogManager] 重置');
|
||||
this.registry.engine3d?.resetSectionBox();
|
||||
},
|
||||
onRangeChange: (range) => {
|
||||
console.log('[SectionBoxDialogManager] 范围变化:', range);
|
||||
this.registry.engine3d?.setSectionBoxRange(range);
|
||||
}
|
||||
});
|
||||
this.panel.init();
|
||||
return this.panel.element;
|
||||
}
|
||||
|
||||
/** 对话框创建后的回调,自适应高度 */
|
||||
/** 对话框创建后的回调,激活剖切盒并自适应高度 */
|
||||
protected onDialogCreated(): void {
|
||||
this.registry.engine3d?.activateSectionBox();
|
||||
this.dialog?.fitHeight(false);
|
||||
}
|
||||
|
||||
@@ -86,8 +89,9 @@ export class SectionBoxDialogManager extends BaseDialogManager {
|
||||
this.registry.toolbar?.setBtnActive('section-box', false);
|
||||
}
|
||||
|
||||
/** 销毁前的清理,销毁面板实例 */
|
||||
/** 销毁前的清理,停用剖切盒并销毁面板实例 */
|
||||
protected onBeforeDestroy(): void {
|
||||
this.registry.engine3d?.deactivateSectionBox();
|
||||
if (this.panel) {
|
||||
this.panel.destroy();
|
||||
this.panel = null;
|
||||
|
||||
@@ -157,4 +157,12 @@ export class ToolbarManager extends BaseManager {
|
||||
public getContainer(): HTMLElement | null {
|
||||
return this.toolbarContainer;
|
||||
}
|
||||
|
||||
public setType(type: 'default' | 'glass-pill'): void {
|
||||
this.toolbar?.setType(type);
|
||||
}
|
||||
|
||||
public getType(): 'default' | 'glass-pill' {
|
||||
return this.toolbar?.getType() || 'default';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,10 @@ export class WalkControlManager extends BaseManager {
|
||||
|
||||
this.registry.toolbar.hide();
|
||||
|
||||
// 打开漫游面板时,默认激活第一人称模式
|
||||
console.log('[WalkControl] 打开漫游面板,激活第一人称模式');
|
||||
this.registry.engine3d?.activateFirstPersonMode();
|
||||
|
||||
this.panel = new WalkControlPanel({
|
||||
onPlanViewToggle: (isActive) => {
|
||||
console.log('[WalkControl] 地图:', isActive);
|
||||
@@ -55,19 +59,16 @@ export class WalkControlManager extends BaseManager {
|
||||
this.emit('walk:path-mode-toggle', { isActive });
|
||||
},
|
||||
onWalkModeToggle: (isActive) => {
|
||||
console.log('[WalkControl] 第一人称漫游:', isActive);
|
||||
console.log('[WalkControl] 第三人称漫游按钮点击:', isActive);
|
||||
if (isActive) {
|
||||
this.pathManager?.hide();
|
||||
this.registry.engine3d?.activateFirstPersonMode();
|
||||
} else {
|
||||
this.registry.engine3d?.deactivateFirstPersonMode();
|
||||
alert('第三人称功能开发中');
|
||||
}
|
||||
this.emit('walk:walk-mode-toggle', { isActive });
|
||||
},
|
||||
onSpeedChange: (speed) => {
|
||||
console.log('[WalkControl] 速度变化:', speed);
|
||||
// 将 UI 速度值转换为引擎速度值(UI: 1-10, 引擎: 0.01-0.1)
|
||||
const engineSpeed = speed * 0.01;
|
||||
const engineSpeed = speed * 0.1;
|
||||
this.registry.engine3d?.setWalkSpeed(engineSpeed);
|
||||
this.emit('walk:speed-change', { speed });
|
||||
},
|
||||
@@ -122,6 +123,9 @@ export class WalkControlManager extends BaseManager {
|
||||
public hide(): void {
|
||||
this.pathManager?.hide();
|
||||
|
||||
console.log('[WalkControl] 关闭漫游面板,退出第一人称模式');
|
||||
this.registry.engine3d?.deactivateFirstPersonMode();
|
||||
|
||||
if (this.panel) {
|
||||
this.panel.destroy();
|
||||
this.panel = null;
|
||||
|
||||
Reference in New Issue
Block a user