docs: update clipping API documentation

- Update method references: activateSectionAxis → activeSection
- Update call chains for all clipping modes (x/y/z/box/face)
- Document new unified API: engine.clipping.active(mode)
- Mark deprecated methods: fitSectionBoxToModel, resetSectionBox
- Update underlying API: updateClippingValue instead of setboxPercent
This commit is contained in:
yuding
2026-02-02 16:25:36 +08:00
parent 679d792de2
commit 5e02ebb8e9
2 changed files with 75 additions and 104 deletions

View File

@@ -113,10 +113,10 @@ export class SectionBoxDialogManager extends BaseDialogManager {
protected createContent(): HTMLElement {
this.panel = new SectionBoxPanel({
onFitToModel: () => {
this.registry.engine3d?.fitSectionBoxToModel(); // ← 调用 EngineManager
console.log('[SectionBoxDialogManager] Fit to model not supported');
},
onReset: () => {
this.registry.engine3d?.resetSectionBox();
console.log('[SectionBoxDialogManager] Reset not supported');
},
onRangeChange: (range) => {
this.registry.engine3d?.setSectionBoxRange(range);
@@ -128,13 +128,13 @@ export class SectionBoxDialogManager extends BaseDialogManager {
// 对话框创建后,激活剖切盒
protected onDialogCreated(): void {
this.registry.engine3d?.activateSectionBox(); // ← 调用 EngineManager
this.registry.engine3d?.activeSection('box'); // ← 调用 EngineManager 统一 API
this.dialog?.fitHeight(false);
}
// 对话框销毁前,停用剖切
// 对话框销毁前,停用剖切
protected onBeforeDestroy(): void {
this.registry.engine3d?.deactivateSectionBox();
this.registry.engine3d?.deactivateSection(); // ← 统一停用方法
// ... 清理
}
@@ -159,13 +159,29 @@ export class SectionBoxDialogManager extends BaseDialogManager {
export class EngineManager extends BaseManager {
private engineInstance: Engine | null = null;
// 激活剖切
public activateSectionBox(): void {
// 激活剖切(统一入口)
public activeSection(mode: 'x' | 'y' | 'z' | 'box' | 'face'): void {
if (!this.engineInstance) {
console.warn('[EngineManager] 3D Engine not initialized.');
return;
}
this.engineInstance.activateSectionBox(); // ← 调用 Engine 组件
this.engineInstance.activeSection(mode); // ← 调用 Engine 组件
}
// 获取当前剖切模式
public getCurrentSectionMode(): 'x' | 'y' | 'z' | 'box' | 'face' | null {
if (!this.engineInstance) {
return null;
}
return this.engineInstance.getCurrentSectionMode();
}
// 停用剖切(统一出口)
public deactivateSection(): void {
if (!this.engineInstance) {
return;
}
this.engineInstance.deactivateSection();
}
// 设置剖切盒范围
@@ -193,11 +209,10 @@ export class EngineManager extends BaseManager {
```typescript
export class Engine implements IBimComponent {
private engine: any = null; // 底层引擎实例
private isSectionBoxActive: boolean = false; // 状态标记
private sectionBoxFullBounds: any = null; // 缓存的包围盒
private currentSectionMode: 'x' | 'y' | 'z' | 'box' | 'face' | null = null; // 当前剖切模式
// 激活剖切
public activateSectionBox(): void {
// 激活剖切(统一入口)
public activeSection(mode: 'x' | 'y' | 'z' | 'box' | 'face'): void {
if (!this._isInitialized || !this.engine) {
console.error('[Engine] Cannot activate section box: engine not initialized.');
return;