refactor(components): accept registry in menu, engine, walk-path, button-group
Menu button factories, Engine component, WalkPathPanel, and BimButtonGroup now accept registry via options/parameters. Engine component adds public resize() method wrapping EngineKernel.handleWindowResize(). Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -1,13 +1,12 @@
|
||||
import { MenuItemConfig } from '../item';
|
||||
import { ManagerRegistry } from '../../../core/manager-registry';
|
||||
import type { ManagerRegistry } from '../../../core/manager-registry';
|
||||
|
||||
export const fourMenuButton = (): MenuItemConfig => {
|
||||
export const fourMenuButton = (registry: ManagerRegistry): MenuItemConfig => {
|
||||
return {
|
||||
id: 'fourMenu',
|
||||
label: 'menu.info',
|
||||
icon: '<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill="currentColor" d="M12 7q.425 0 .713-.288T13 6t-.288-.712T12 5t-.712.288T11 6t.288.713T12 7m0 8q.425 0 .713-.288T13 14v-4q0-.425-.288-.712T12 9t-.712.288T11 10v4q0 .425.288.713T12 15m-6 3l-2.3 2.3q-.475.475-1.088.213T2 19.575V4q0-.825.588-1.412T4 2h16q.825 0 1.413.588T22 4v12q0 .825-.587 1.413T20 18z"/></svg>',
|
||||
onClick: () => {
|
||||
const registry = ManagerRegistry.getInstance();
|
||||
registry.engineInfo?.show();
|
||||
registry.engine3d?.rightKey?.hide();
|
||||
}
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
import { MenuItemConfig } from '../item';
|
||||
import { ManagerRegistry } from '../../../core/manager-registry';
|
||||
import type { ManagerRegistry } from '../../../core/manager-registry';
|
||||
import { secondMenuButton } from './second';
|
||||
import { fourMenuButton } from './four';
|
||||
|
||||
export const homeMenuButton = (): MenuItemConfig => {
|
||||
export const homeMenuButton = (registry: ManagerRegistry): MenuItemConfig => {
|
||||
return {
|
||||
id: 'homeMenu',
|
||||
label: 'menu.home',
|
||||
group: 'home',
|
||||
children: [secondMenuButton(), fourMenuButton()],
|
||||
children: [secondMenuButton(registry), fourMenuButton(registry)],
|
||||
icon: '<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill="currentColor" d="M12 7q.425 0 .713-.288T13 6t-.288-.712T12 5t-.712.288T11 6t.288.713T12 7m0 8q.425 0 .713-.288T13 14v-4q0-.425-.288-.712T12 9t-.712.288T11 10v4q0 .425.288.713T12 15m-6 3l-2.3 2.3q-.475.475-1.088.213T2 19.575V4q0-.825.588-1.412T4 2h16q.825 0 1.413.588T22 4v12q0 .825-.587 1.413T20 18z"/></svg>',
|
||||
onClick: () => {
|
||||
const registry = ManagerRegistry.getInstance();
|
||||
registry.engineInfo?.show();
|
||||
registry.engine3d?.rightKey?.hide();
|
||||
}
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
import { MenuItemConfig } from '../item';
|
||||
import { ManagerRegistry } from '../../../core/manager-registry';
|
||||
import type { ManagerRegistry } from '../../../core/manager-registry';
|
||||
|
||||
export const infoMenuButton = (): MenuItemConfig => {
|
||||
export const infoMenuButton = (registry: ManagerRegistry): MenuItemConfig => {
|
||||
return {
|
||||
id: 'infoMenu',
|
||||
label: 'menu.info',
|
||||
group: 'info',
|
||||
icon: '<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill="currentColor" d="M12 7q.425 0 .713-.288T13 6t-.288-.712T12 5t-.712.288T11 6t.288.713T12 7m0 8q.425 0 .713-.288T13 14v-4q0-.425-.288-.712T12 9t-.712.288T11 10v4q0 .425.288.713T12 15m-6 3l-2.3 2.3q-.475.475-1.088.213T2 19.575V4q0-.825.588-1.412T4 2h16q.825 0 1.413.588T22 4v12q0 .825-.587 1.413T20 18z"/></svg>',
|
||||
onClick: () => {
|
||||
const registry = ManagerRegistry.getInstance();
|
||||
registry.engineInfo?.show();
|
||||
registry.engine3d?.rightKey?.hide();
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
import { MenuItemConfig } from '../item';
|
||||
import { ManagerRegistry } from '../../../core/manager-registry';
|
||||
import type { ManagerRegistry } from '../../../core/manager-registry';
|
||||
|
||||
export const secondMenuButton = (): MenuItemConfig => {
|
||||
export const secondMenuButton = (registry: ManagerRegistry): MenuItemConfig => {
|
||||
return {
|
||||
id: 'infoMenu',
|
||||
label: 'menu.info',
|
||||
icon: '<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill="currentColor" d="M12 7q.425 0 .713-.288T13 6t-.288-.712T12 5t-.712.288T11 6t.288.713T12 7m0 8q.425 0 .713-.288T13 14v-4q0-.425-.288-.712T12 9t-.712.288T11 10v4q0 .425.288.713T12 15m-6 3l-2.3 2.3q-.475.475-1.088.213T2 19.575V4q0-.825.588-1.412T4 2h16q.825 0 1.413.588T22 4v12q0 .825-.587 1.413T20 18z"/></svg>',
|
||||
onClick: () => {
|
||||
const registry = ManagerRegistry.getInstance();
|
||||
registry.engineInfo?.show();
|
||||
registry.engine3d?.rightKey?.hide();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user