refactor(bim-engine): create ManagerRegistry instance and inject into managers
BimEngine now instantiates its own ManagerRegistry and passes it to all managers during initialization. Each BimEngine instance is fully isolated. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -56,7 +56,7 @@ export class BimEngine {
|
|||||||
if (!el) throw new Error('Container not found');
|
if (!el) throw new Error('Container not found');
|
||||||
this.container = el;
|
this.container = el;
|
||||||
|
|
||||||
this.registry = ManagerRegistry.getInstance();
|
this.registry = new ManagerRegistry();
|
||||||
|
|
||||||
if (options?.locale) localeManager.setLocale(options.locale);
|
if (options?.locale) localeManager.setLocale(options.locale);
|
||||||
if (options?.theme) {
|
if (options?.theme) {
|
||||||
@@ -103,20 +103,20 @@ export class BimEngine {
|
|||||||
this.registry.container = this.container;
|
this.registry.container = this.container;
|
||||||
this.registry.wrapper = this.wrapper;
|
this.registry.wrapper = this.wrapper;
|
||||||
|
|
||||||
this.engine = new EngineManager(this.wrapper);
|
this.engine = new EngineManager(this.wrapper, this.registry);
|
||||||
this.dialog = new DialogManager(this.wrapper);
|
this.dialog = new DialogManager(this.wrapper, this.registry);
|
||||||
this.toolbar = new ToolbarManager(this.wrapper);
|
this.toolbar = new ToolbarManager(this.wrapper, this.registry);
|
||||||
this.buttonGroup = new ButtonGroupManager(this.wrapper);
|
this.buttonGroup = new ButtonGroupManager(this.wrapper, this.registry);
|
||||||
this.rightKey = new RightKeyManager(this.wrapper);
|
this.rightKey = new RightKeyManager(this.wrapper, this.registry);
|
||||||
this.constructTreeBtn = new ConstructTreeManagerBtn(this.wrapper);
|
this.constructTreeBtn = new ConstructTreeManagerBtn(this.wrapper, this.registry);
|
||||||
|
|
||||||
this.measure = new MeasureDialogManager();
|
this.measure = new MeasureDialogManager(this.registry);
|
||||||
this.sectionPlane = new SectionPlaneDialogManager();
|
this.sectionPlane = new SectionPlaneDialogManager(this.registry);
|
||||||
this.sectionAxis = new SectionAxisDialogManager();
|
this.sectionAxis = new SectionAxisDialogManager(this.registry);
|
||||||
this.sectionBox = new SectionBoxDialogManager();
|
this.sectionBox = new SectionBoxDialogManager(this.registry);
|
||||||
this.walkControl = new WalkControlManager();
|
this.walkControl = new WalkControlManager(this.registry);
|
||||||
this.walkControl.init();
|
this.walkControl.init();
|
||||||
this.engineInfo = new EngineInfoDialogManager();
|
this.engineInfo = new EngineInfoDialogManager(this.registry);
|
||||||
this.engineInfo.init();
|
this.engineInfo.init();
|
||||||
|
|
||||||
this.registry.engine3d = this.engine;
|
this.registry.engine3d = this.engine;
|
||||||
@@ -133,11 +133,11 @@ export class BimEngine {
|
|||||||
this.registry.walkControl = this.walkControl;
|
this.registry.walkControl = this.walkControl;
|
||||||
this.registry.engineInfo = this.engineInfo;
|
this.registry.engineInfo = this.engineInfo;
|
||||||
|
|
||||||
this.componentDetail = new ComponentDetailManager();
|
this.componentDetail = new ComponentDetailManager(this.registry);
|
||||||
this.registry.componentDetail = this.componentDetail;
|
this.registry.componentDetail = this.componentDetail;
|
||||||
this.componentDetail.init();
|
this.componentDetail.init();
|
||||||
|
|
||||||
this.aiChat = new AiChatManager();
|
this.aiChat = new AiChatManager(this.registry);
|
||||||
this.registry.aiChat = this.aiChat;
|
this.registry.aiChat = this.aiChat;
|
||||||
this.aiChat.init();
|
this.aiChat.init();
|
||||||
|
|
||||||
@@ -167,6 +167,6 @@ export class BimEngine {
|
|||||||
this.walkControl?.destroy();
|
this.walkControl?.destroy();
|
||||||
this.aiChat?.destroy();
|
this.aiChat?.destroy();
|
||||||
this.container.innerHTML = '';
|
this.container.innerHTML = '';
|
||||||
ManagerRegistry.reset();
|
this.registry.reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user