初始化
This commit is contained in:
54
src/components/walk-path-panel/index.ts
Normal file
54
src/components/walk-path-panel/index.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
import type { ThemeConfig } from '../../themes/types';
|
||||
import { IBimComponent } from '../../types/component';
|
||||
import { localeManager } from '../../services/locale';
|
||||
import { themeManager } from '../../services/theme';
|
||||
|
||||
/**
|
||||
* 路径漫游面板组件(暂时空内容)
|
||||
*/
|
||||
export class WalkPathPanel implements IBimComponent {
|
||||
public element!: HTMLElement;
|
||||
|
||||
private unsubscribeLocale: (() => void) | null = null;
|
||||
private unsubscribeTheme: (() => void) | null = null;
|
||||
|
||||
constructor() {
|
||||
// 暂时无配置
|
||||
}
|
||||
|
||||
public init(): void {
|
||||
this.element = this.createPanel();
|
||||
|
||||
// 订阅
|
||||
this.unsubscribeLocale = localeManager.subscribe(() => this.setLocales());
|
||||
this.unsubscribeTheme = themeManager.subscribe((theme) => this.setTheme(theme));
|
||||
|
||||
this.setLocales();
|
||||
this.setTheme(themeManager.getTheme());
|
||||
}
|
||||
|
||||
private createPanel(): HTMLElement {
|
||||
const panel = document.createElement('div');
|
||||
panel.className = 'walk-path-panel';
|
||||
panel.style.padding = '20px';
|
||||
panel.style.color = 'var(--bim-text-color, #fff)';
|
||||
panel.textContent = '路径漫游内容待实现';
|
||||
return panel;
|
||||
}
|
||||
|
||||
public setLocales(): void {
|
||||
// 更新文本
|
||||
}
|
||||
|
||||
public setTheme(_theme: ThemeConfig): void {
|
||||
// 应用主题
|
||||
}
|
||||
|
||||
public destroy(): void {
|
||||
this.unsubscribeLocale?.();
|
||||
this.unsubscribeTheme?.();
|
||||
if (this.element && this.element.parentElement) {
|
||||
this.element.parentElement.removeChild(this.element);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user