refactor: slim down EngineManager from 861 to 290 lines by removing passthrough proxy pattern

- EngineManager now only exposes public SDK API (initialize, loadModel, pause/resumeRendering, getEngineComponent, destroy)
- Internal managers access Engine component directly via this.engineComponent getter on BaseManager
- Non-manager components use registry.engine3d.getEngineComponent() for direct Engine access
- Replaced getEngine() with onRawEvent()/offRawEvent() for raw engine event access
- Migrated 62 call sites across 13 files (9 managers, 1 panel, 3 toolbar buttons)
- Updated all architecture docs, API docs, and README to reflect new patterns
This commit is contained in:
yuding
2026-03-05 11:15:57 +08:00
parent c3bd82c03a
commit b96e5f3262
28 changed files with 3786 additions and 6261 deletions

View File

@@ -64,9 +64,9 @@ export class SectionAxisDialogManager extends BaseDialogManager {
onHideToggle: (isHidden) => {
console.log('[SectionAxisDialogManager] 隐藏切换:', isHidden);
if (isHidden) {
this.registry.engine3d?.hideSection();
this.engineComponent?.hideSection();
} else {
this.registry.engine3d?.recoverSection();
this.engineComponent?.recoverSection();
}
},
onReverse: () => {
@@ -75,7 +75,7 @@ export class SectionAxisDialogManager extends BaseDialogManager {
},
onAxisChange: (axis) => {
console.log('[SectionAxisDialogManager] 切换轴向:', axis);
this.registry.engine3d?.activeSection(axis);
this.engineComponent?.activeSection(axis);
}
});
this.panel.init();
@@ -87,13 +87,13 @@ export class SectionAxisDialogManager extends BaseDialogManager {
this.dialog?.fitHeight(false);
// 检查 Engine 是否已初始化
if (!this.registry.engine3d) {
if (!this.engineComponent) {
console.error('[SectionAxisDialogManager] Engine not initialized. Call initEngine() first.');
return;
}
// 自动激活默认轴向剖切X轴
this.registry.engine3d.activeSection('x');
this.engineComponent.activeSection('x');
}
/** 对话框关闭时的回调,取消工具栏按钮激活状态 */
@@ -103,7 +103,7 @@ export class SectionAxisDialogManager extends BaseDialogManager {
/** 销毁前的清理,销毁面板实例 */
protected onBeforeDestroy(): void {
this.registry.engine3d?.deactivateSection();
this.engineComponent?.deactivateSection();
if (this.panel) {
this.panel.destroy();