更新图钉 API 文档及代码
This commit is contained in:
@@ -152,6 +152,8 @@ export class ComponentDetailManager extends BaseManager {
|
||||
const row = document.createElement('div');
|
||||
row.style.cssText = `
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
border-bottom: 1px solid var(--bim-border-default, rgba(255,255,255,0.15));
|
||||
`;
|
||||
|
||||
@@ -163,22 +165,37 @@ export class ComponentDetailManager extends BaseManager {
|
||||
label.style.cssText = `
|
||||
width: 120px;
|
||||
flex-shrink: 0;
|
||||
padding: 8px 12px;
|
||||
`;
|
||||
const labelText = document.createElement('div');
|
||||
labelText.style.cssText = `
|
||||
color: var(--bim-text-secondary, #999);
|
||||
font-size: 13px;
|
||||
padding: 8px 12px;
|
||||
border-right: 1px solid var(--bim-border-default, rgba(255,255,255,0.15));
|
||||
font-weight: 600;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
`;
|
||||
label.textContent = item.name || '-';
|
||||
labelText.textContent = item.name || '-';
|
||||
label.appendChild(labelText);
|
||||
|
||||
const value = document.createElement('div');
|
||||
value.style.cssText = `
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
padding: 8px 12px;
|
||||
`;
|
||||
const valueText = document.createElement('div');
|
||||
valueText.style.cssText = `
|
||||
color: var(--bim-text-primary, #fff);
|
||||
font-size: 13px;
|
||||
padding: 8px 12px;
|
||||
word-break: break-all;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
`;
|
||||
value.textContent = String(item.value ?? '-');
|
||||
const valueContent = String(item.value ?? '-');
|
||||
valueText.textContent = valueContent;
|
||||
value.appendChild(valueText);
|
||||
|
||||
row.appendChild(label);
|
||||
row.appendChild(value);
|
||||
|
||||
67
src/managers/component-tree-drawer-manager.ts
Normal file
67
src/managers/component-tree-drawer-manager.ts
Normal file
@@ -0,0 +1,67 @@
|
||||
import { ComponentTreeDrawer } from '../components/component-tree-drawer';
|
||||
import type { ComponentTreeDrawerTabApi, ComponentTreeDrawerTabId } from '../components/component-tree-drawer/types';
|
||||
import { BaseManager } from '../core/base-manager';
|
||||
import { ManagerRegistry } from '../core/manager-registry';
|
||||
|
||||
export class ComponentTreeDrawerManager extends BaseManager {
|
||||
private drawer: ComponentTreeDrawer | null = null;
|
||||
|
||||
constructor(registry: ManagerRegistry) {
|
||||
super(registry);
|
||||
this.init();
|
||||
}
|
||||
|
||||
public init(): void {
|
||||
if (this.drawer || !this.registry.wrapper) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.drawer = new ComponentTreeDrawer({
|
||||
container: this.registry.wrapper,
|
||||
registry: this.registry
|
||||
});
|
||||
this.drawer.init();
|
||||
}
|
||||
|
||||
public open(tabId?: ComponentTreeDrawerTabId): void {
|
||||
this.drawer?.openDrawer(tabId);
|
||||
}
|
||||
|
||||
public close(): void {
|
||||
this.drawer?.close();
|
||||
}
|
||||
|
||||
public toggle(tabId?: ComponentTreeDrawerTabId): void {
|
||||
this.drawer?.toggle(tabId);
|
||||
}
|
||||
|
||||
public switchTab(tabId: ComponentTreeDrawerTabId): void {
|
||||
this.drawer?.switchTab(tabId);
|
||||
}
|
||||
|
||||
public isOpen(): boolean {
|
||||
return this.drawer?.isOpen() ?? false;
|
||||
}
|
||||
|
||||
public getActiveTab(): ComponentTreeDrawerTabId {
|
||||
return this.drawer?.getActiveTab() ?? 'construct-tree';
|
||||
}
|
||||
|
||||
public getViewTabApi(): ComponentTreeDrawerTabApi | null {
|
||||
return this.drawer?.getViewTabApi() ?? null;
|
||||
}
|
||||
|
||||
public getPinTabApi(): ComponentTreeDrawerTabApi | null {
|
||||
return this.drawer?.getPinTabApi() ?? null;
|
||||
}
|
||||
|
||||
public getConstructTreeTabApi(): ComponentTreeDrawerTabApi | null {
|
||||
return this.drawer?.getConstructTreeTabApi() ?? null;
|
||||
}
|
||||
|
||||
public destroy(): void {
|
||||
this.drawer?.destroy();
|
||||
this.drawer = null;
|
||||
super.destroy();
|
||||
}
|
||||
}
|
||||
@@ -312,6 +312,10 @@ export class ConstructTreeManagerBtn extends BaseManager {
|
||||
label: 'construct-tree',
|
||||
icon: getIcon('目录树'),
|
||||
onClick: () => {
|
||||
if (this.registry.componentTreeDrawer) {
|
||||
this.registry.componentTreeDrawer.toggle();
|
||||
return;
|
||||
}
|
||||
this.openConstructTreeDialog();
|
||||
}
|
||||
});
|
||||
@@ -330,6 +334,11 @@ export class ConstructTreeManagerBtn extends BaseManager {
|
||||
* 6. 创建对话框并显示
|
||||
*/
|
||||
public async openConstructTreeDialog() {
|
||||
if (this.registry.componentTreeDrawer) {
|
||||
this.registry.componentTreeDrawer.open();
|
||||
return;
|
||||
}
|
||||
|
||||
// 隐藏按钮组,避免遮挡对话框
|
||||
this.setVisible(false);
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import { BaseManager } from '../core/base-manager';
|
||||
import { RightKeyManager } from './right-key-manager';
|
||||
import type { MenuItemConfig } from '../components/menu/item';
|
||||
import { ManagerRegistry } from '../core/manager-registry';
|
||||
import type { DrawingPinRecord } from '../types/events';
|
||||
|
||||
/**
|
||||
* 3D 引擎管理器
|
||||
@@ -302,6 +303,14 @@ export class EngineManager extends BaseManager {
|
||||
return this.engineInstance.jumpToCamera(cameraData);
|
||||
}
|
||||
|
||||
public setMainViewPort(viewData: any): void {
|
||||
if (!this.engineInstance) {
|
||||
console.warn('[EngineManager] 3D Engine not initialized.');
|
||||
return;
|
||||
}
|
||||
this.engineInstance.setMainViewPort(viewData);
|
||||
}
|
||||
|
||||
public getConstructTreeData(): { level: any[]; type: any[]; major: any[] } {
|
||||
if (!this.engineInstance) {
|
||||
console.warn('[EngineManager] 3D Engine not initialized.');
|
||||
@@ -322,6 +331,19 @@ export class EngineManager extends BaseManager {
|
||||
this.engineInstance.getComponentProperties(url, id, callback);
|
||||
}
|
||||
|
||||
public setPinRecords(records: DrawingPinRecord[]): void {
|
||||
console.log('[EngineManager] setPinRecords called, records count:', records.length);
|
||||
if (!this.engineInstance) {
|
||||
console.warn('[EngineManager] 3D Engine not initialized.');
|
||||
return;
|
||||
}
|
||||
this.engineInstance.setPinRecords(records);
|
||||
}
|
||||
|
||||
public setPinList(records: DrawingPinRecord[]): void {
|
||||
this.setPinRecords(records);
|
||||
}
|
||||
|
||||
public registerRightKeyHandler(handler: (e: MouseEvent) => MenuItemConfig[] | null): void {
|
||||
if (!this.rightKey) {
|
||||
console.warn('[EngineManager] RightKey manager not initialized.');
|
||||
|
||||
@@ -71,6 +71,7 @@ export class MeasureDialogManager extends BaseDialogManager {
|
||||
},
|
||||
});
|
||||
this.panel.init();
|
||||
this.engineComponent?.activateMeasure('distance');
|
||||
|
||||
this.config = this.panel.getConfig();
|
||||
if (this.config) {
|
||||
@@ -97,18 +98,25 @@ export class MeasureDialogManager extends BaseDialogManager {
|
||||
|
||||
const ec = this.engineComponent;
|
||||
if (ec) {
|
||||
const handler = (data: EngineMeasureData) => {
|
||||
console.log('[MeasureDialogManager] 测量值回调:', data);
|
||||
if (data && this.panel) {
|
||||
this.handleMeasureChanged(data);
|
||||
}
|
||||
};
|
||||
ec.onRawEvent('measure-changed', handler);
|
||||
ec.onRawEvent('measure-click', handler);
|
||||
this.unsubscribeMeasureChanged = () => {
|
||||
ec.offRawEvent('measure-changed', handler);
|
||||
ec.offRawEvent('measure-click', handler);
|
||||
const handler = (data: EngineMeasureData) => {
|
||||
console.log('[MeasureDialogManager] 测量值回调:', data);
|
||||
if (data && this.panel) {
|
||||
this.handleMeasureChanged(data);
|
||||
}
|
||||
};
|
||||
const quitHandler = () => {
|
||||
console.log('[MeasureDialogManager] quit_measure_draw received');
|
||||
this.panel?.clearActiveMode();
|
||||
this.engineComponent?.resetMeasureState();
|
||||
};
|
||||
ec.onRawEvent('measure-changed', handler);
|
||||
ec.onRawEvent('measure-click', handler);
|
||||
ec.onRawEvent('quit_measure_draw', quitHandler);
|
||||
this.unsubscribeMeasureChanged = () => {
|
||||
ec.offRawEvent('measure-changed', handler);
|
||||
ec.offRawEvent('measure-click', handler);
|
||||
ec.offRawEvent('quit_measure_draw', quitHandler);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -99,6 +99,7 @@ export class MeasureDockManager extends BaseManager {
|
||||
});
|
||||
this.panel.init();
|
||||
this.panel.switchMode('distance');
|
||||
this.engineComponent?.activateMeasure('distance');
|
||||
this.engineComponent?.setClearHeightDirection(1);
|
||||
this.engineComponent?.setClearHeightSelectType('point');
|
||||
const config = this.panel.getConfig();
|
||||
@@ -108,6 +109,7 @@ export class MeasureDockManager extends BaseManager {
|
||||
});
|
||||
} else {
|
||||
this.panel.switchMode('distance');
|
||||
this.engineComponent?.activateMeasure('distance');
|
||||
}
|
||||
this.applyPresentation();
|
||||
return this.panel.element;
|
||||
@@ -130,12 +132,19 @@ export class MeasureDockManager extends BaseManager {
|
||||
const clickHandler = (data: EngineMeasureData) => {
|
||||
this.handleMeasureCallback('measure-click', data);
|
||||
};
|
||||
const quitHandler = () => {
|
||||
console.log('[MeasureDockManager] quit_measure_draw received');
|
||||
this.panel?.clearActiveMode();
|
||||
this.engineComponent?.resetMeasureState();
|
||||
};
|
||||
|
||||
ec.onRawEvent('measure-changed', changedHandler);
|
||||
ec.onRawEvent('measure-click', clickHandler);
|
||||
ec.onRawEvent('quit_measure_draw', quitHandler);
|
||||
this.unsubscribeMeasureEvents = () => {
|
||||
ec.offRawEvent('measure-changed', changedHandler);
|
||||
ec.offRawEvent('measure-click', clickHandler);
|
||||
ec.offRawEvent('quit_measure_draw', quitHandler);
|
||||
};
|
||||
|
||||
console.log('[MeasureDockManager] raw event callbacks bound');
|
||||
|
||||
@@ -1,145 +0,0 @@
|
||||
/**
|
||||
* 漫游控制管理器
|
||||
* 负责管理漫游模式的控制面板和相关交互
|
||||
*/
|
||||
import { BaseManager } from '../core/base-manager';
|
||||
import { ManagerRegistry } from '../core/manager-registry';
|
||||
import { WalkControlPanel } from '../components/walk-control-panel';
|
||||
import { WalkPathDialogManager } from './walk-path-dialog-manager';
|
||||
|
||||
/**
|
||||
* 漫游控制管理器
|
||||
* 提供第一人称漫游、路径漫游等功能的控制界面
|
||||
*/
|
||||
export class WalkControlManager extends BaseManager {
|
||||
/** 漫游控制面板实例 */
|
||||
public panel: WalkControlPanel | null = null;
|
||||
/** 路径漫游对话框管理器 */
|
||||
private pathManager: WalkPathDialogManager | null = null;
|
||||
|
||||
constructor(registry: ManagerRegistry) {
|
||||
super(registry);
|
||||
}
|
||||
|
||||
/** 初始化管理器 */
|
||||
public init(): void {
|
||||
this.pathManager = new WalkPathDialogManager(this.registry);
|
||||
this.pathManager.init();
|
||||
}
|
||||
|
||||
/** 显示漫游控制面板 */
|
||||
public show(): void {
|
||||
this.registry.toolbar?.hide();
|
||||
|
||||
// 打开漫游面板时,默认激活第一人称模式
|
||||
console.log('[WalkControl] 打开漫游面板,激活第一人称模式');
|
||||
this.engineComponent?.activateFirstPersonMode();
|
||||
|
||||
const engineSpeed = this.engineComponent?.getWalkSpeed() ?? 1;
|
||||
const panelSpeed = Math.round(engineSpeed / 0.1);
|
||||
console.log('[WalkControl] 初始速度 - engineSpeed:', engineSpeed, 'panelSpeed:', panelSpeed);
|
||||
|
||||
this.panel = new WalkControlPanel({
|
||||
defaultSpeed: panelSpeed,
|
||||
onPlanViewToggle: (isActive) => {
|
||||
console.log('[WalkControl] 小地图:', isActive);
|
||||
this.engineComponent?.toggleMiniMap();
|
||||
// 同步工具栏地图按钮的激活状态
|
||||
this.registry.toolbar?.setBtnActive('map', isActive);
|
||||
this.emit('walk:plan-view-toggle', { isActive });
|
||||
},
|
||||
onPathModeToggle: (isActive) => {
|
||||
console.log('[WalkControl] 路径漫游:', isActive);
|
||||
if (isActive) {
|
||||
this.pathManager?.show();
|
||||
} else {
|
||||
this.pathManager?.hide();
|
||||
}
|
||||
this.emit('walk:path-mode-toggle', { isActive });
|
||||
},
|
||||
onWalkModeToggle: (isActive) => {
|
||||
console.log('[WalkControl] 第三人称漫游按钮点击:', isActive);
|
||||
if (isActive) {
|
||||
this.pathManager?.hide();
|
||||
alert('第三人称功能开发中');
|
||||
}
|
||||
this.emit('walk:walk-mode-toggle', { isActive });
|
||||
},
|
||||
onSpeedChange: (speed) => {
|
||||
console.log('[WalkControl] 速度变化:', speed);
|
||||
const engineSpeed = speed * 0.1;
|
||||
this.engineComponent?.setWalkSpeed(engineSpeed);
|
||||
this.emit('walk:speed-change', { speed });
|
||||
},
|
||||
onGravityToggle: (enabled) => {
|
||||
console.log('[WalkControl] 重力:', enabled);
|
||||
this.engineComponent?.setWalkGravity(enabled);
|
||||
this.emit('walk:gravity-toggle', { enabled });
|
||||
},
|
||||
onCollisionToggle: (enabled) => {
|
||||
console.log('[WalkControl] 碰撞:', enabled);
|
||||
this.engineComponent?.setWalkCollision(enabled);
|
||||
this.emit('walk:collision-toggle', { enabled });
|
||||
},
|
||||
onCharacterModelChange: (model) => {
|
||||
console.log('[WalkControl] 角色模型:', model);
|
||||
},
|
||||
onWalkModeChange: (mode) => {
|
||||
console.log('[WalkControl] 行走模式:', mode);
|
||||
},
|
||||
onExit: () => {
|
||||
this.hide();
|
||||
}
|
||||
});
|
||||
this.panel.init();
|
||||
|
||||
// 同步当前地图状态到漫游面板
|
||||
const mapState = this.engineComponent?.getMiniMapState() ?? false;
|
||||
this.panel.setPlanViewActive(mapState);
|
||||
|
||||
if (this.registry.container) {
|
||||
this.panel.element.style.position = 'absolute';
|
||||
this.panel.element.style.bottom = '20px';
|
||||
this.panel.element.style.left = '50%';
|
||||
this.panel.element.style.transform = 'translateX(-50%)';
|
||||
this.panel.element.style.zIndex = '1000';
|
||||
|
||||
this.registry.container.appendChild(this.panel.element);
|
||||
} else {
|
||||
console.warn('[WalkControlManager] Container not found');
|
||||
}
|
||||
}
|
||||
|
||||
/** 隐藏漫游控制面板 */
|
||||
public hide(): void {
|
||||
this.pathManager?.hide();
|
||||
|
||||
// 如果小地图开着,先关闭它
|
||||
if (this.engineComponent?.getMiniMapState()) {
|
||||
this.engineComponent.toggleMiniMap();
|
||||
}
|
||||
|
||||
console.log('[WalkControl] 关闭漫游面板,退出第一人称模式');
|
||||
this.engineComponent?.deactivateFirstPersonMode();
|
||||
|
||||
if (this.panel) {
|
||||
this.panel.destroy();
|
||||
this.panel = null;
|
||||
}
|
||||
|
||||
// 同步工具栏地图按钮的激活状态
|
||||
this.registry.toolbar?.setBtnActive('map', false);
|
||||
|
||||
if (this.registry.toolbar) {
|
||||
this.registry.toolbar.show();
|
||||
}
|
||||
}
|
||||
|
||||
/** 销毁管理器 */
|
||||
public destroy(): void {
|
||||
this.hide();
|
||||
this.pathManager?.destroy();
|
||||
this.pathManager = null;
|
||||
super.destroy();
|
||||
}
|
||||
}
|
||||
@@ -67,8 +67,7 @@ export class WalkDockManager extends BaseManager {
|
||||
this.emit('walk:walk-mode-toggle', { isActive });
|
||||
},
|
||||
onSpeedChange: (speed) => {
|
||||
const engineSpeed = speed * 0.1;
|
||||
this.engineComponent?.setWalkSpeed(engineSpeed);
|
||||
this.engineComponent?.setWalkSpeed(speed);
|
||||
this.emit('walk:speed-change', { speed });
|
||||
},
|
||||
onGravityToggle: (enabled) => {
|
||||
@@ -96,14 +95,25 @@ export class WalkDockManager extends BaseManager {
|
||||
return this.panel.element;
|
||||
}
|
||||
|
||||
public setPlanViewActive(active: boolean): void {
|
||||
this.panel?.setPlanViewActive(active);
|
||||
}
|
||||
|
||||
public setPathModeActive(active: boolean): void {
|
||||
this.panel?.setPathModeActive(active);
|
||||
}
|
||||
|
||||
private onOpen(): void {
|
||||
this.engineComponent?.activateFirstPersonMode();
|
||||
this.syncMapState();
|
||||
|
||||
this.engineComponent?.setWalkSpeed(5)
|
||||
const engineSpeed = this.engineComponent?.getWalkSpeed() ?? 1;
|
||||
const panelSpeed = Math.round(engineSpeed / 0.1);
|
||||
console.log('[WalkDock] 初始速度 - engineSpeed:', engineSpeed, 'panelSpeed:', panelSpeed);
|
||||
this.panel?.setSpeed(panelSpeed);
|
||||
const engineGravity = this.engineComponent?.getWalkGravity() ?? false;
|
||||
const engineCollision = this.engineComponent?.getWalkCollision() ?? false;
|
||||
console.log('[WalkDock] 初始状态 - speed:', engineSpeed, 'gravity:', engineGravity, 'collision:', engineCollision);
|
||||
this.panel?.setSpeed(engineSpeed);
|
||||
this.panel?.setGravity(engineGravity);
|
||||
this.panel?.setCollision(engineCollision);
|
||||
}
|
||||
|
||||
private onClose(): void {
|
||||
|
||||
@@ -57,9 +57,7 @@ export class WalkPathDialogManager extends BaseDialogManager {
|
||||
|
||||
/** 对话框关闭时的回调 */
|
||||
protected onDialogClose(): void {
|
||||
if (this.registry.walkControl && this.registry.walkControl.panel) {
|
||||
this.registry.walkControl.panel.setPathModeActive(false);
|
||||
}
|
||||
this.registry.walkDock?.setPathModeActive(false);
|
||||
}
|
||||
|
||||
/** 销毁前的清理 */
|
||||
|
||||
@@ -57,9 +57,7 @@ export class WalkPlanViewDialogManager extends BaseDialogManager {
|
||||
|
||||
/** 对话框关闭时的回调 */
|
||||
protected onDialogClose(): void {
|
||||
if (this.registry.walkControl && this.registry.walkControl.panel) {
|
||||
this.registry.walkControl.panel.setPlanViewActive(false);
|
||||
}
|
||||
this.registry.walkDock?.setPlanViewActive(false);
|
||||
}
|
||||
|
||||
/** 销毁前的清理 */
|
||||
|
||||
Reference in New Issue
Block a user