From 679d792de236d9bb138daeada94608150a653e78 Mon Sep 17 00:00:00 2001 From: yuding <1023798085@qq.com> Date: Mon, 2 Feb 2026 16:25:32 +0800 Subject: [PATCH] refactor(section-managers): adapt to unified clipping API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SectionAxisDialogManager: - Update activateSectionAxis → activeSection in callbacks SectionBoxDialogManager: - Update activateSectionBox → activeSection('box') - Disable fitSectionBoxToModel and resetSectionBox (not supported) SectionPlaneDialogManager: - Add activeSection('face') to onDialogCreated - Add deactivateSection() to onBeforeDestroy - Wire onHide to engine.clipping.disabled() - Keep onReverse/onReset as log-only (not supported) --- src/managers/section-axis-dialog-manager.ts | 7 +++---- src/managers/section-box-dialog-manager.ts | 8 ++++---- src/managers/section-plane-dialog-manager.ts | 14 ++++++++++++-- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/managers/section-axis-dialog-manager.ts b/src/managers/section-axis-dialog-manager.ts index b121e63..3b44701 100644 --- a/src/managers/section-axis-dialog-manager.ts +++ b/src/managers/section-axis-dialog-manager.ts @@ -66,7 +66,7 @@ export class SectionAxisDialogManager extends BaseDialogManager { }, onAxisChange: (axis) => { console.log('[SectionAxisDialogManager] 切换轴向:', axis); - this.registry.engine3d?.activateSectionAxis(axis); + this.registry.engine3d?.activeSection(axis); } }); this.panel.init(); @@ -84,7 +84,7 @@ export class SectionAxisDialogManager extends BaseDialogManager { } // 自动激活默认轴向剖切(X轴) - this.registry.engine3d.activateSectionAxis('x'); + this.registry.engine3d.activeSection('x'); } /** 对话框关闭时的回调,取消工具栏按钮激活状态 */ @@ -94,8 +94,7 @@ export class SectionAxisDialogManager extends BaseDialogManager { /** 销毁前的清理,销毁面板实例 */ protected onBeforeDestroy(): void { - // 停用轴向剖切 - this.registry.engine3d?.deactivateSectionAxis(); + this.registry.engine3d?.deactivateSection(); if (this.panel) { this.panel.destroy(); diff --git a/src/managers/section-box-dialog-manager.ts b/src/managers/section-box-dialog-manager.ts index c9b18df..88d4be0 100644 --- a/src/managers/section-box-dialog-manager.ts +++ b/src/managers/section-box-dialog-manager.ts @@ -65,10 +65,10 @@ export class SectionBoxDialogManager extends BaseDialogManager { console.log('[SectionBoxDialogManager] 反向切换(底层暂不支持):', isReversed); }, onFitToModel: () => { - this.registry.engine3d?.fitSectionBoxToModel(); + console.log('[SectionBoxDialogManager] Fit to model not supported in new API'); }, onReset: () => { - this.registry.engine3d?.resetSectionBox(); + console.log('[SectionBoxDialogManager] Reset not supported in new API'); }, onRangeChange: (range) => { this.registry.engine3d?.setSectionBoxRange(range); @@ -80,7 +80,7 @@ export class SectionBoxDialogManager extends BaseDialogManager { /** 对话框创建后的回调,激活剖切盒并自适应高度 */ protected onDialogCreated(): void { - this.registry.engine3d?.activateSectionBox(); + this.registry.engine3d?.activeSection('box'); this.dialog?.fitHeight(false); } @@ -91,7 +91,7 @@ export class SectionBoxDialogManager extends BaseDialogManager { /** 销毁前的清理,停用剖切盒并销毁面板实例 */ protected onBeforeDestroy(): void { - this.registry.engine3d?.deactivateSectionBox(); + this.registry.engine3d?.deactivateSection(); if (this.panel) { this.panel.destroy(); this.panel = null; diff --git a/src/managers/section-plane-dialog-manager.ts b/src/managers/section-plane-dialog-manager.ts index d029f66..50e85ee 100644 --- a/src/managers/section-plane-dialog-manager.ts +++ b/src/managers/section-plane-dialog-manager.ts @@ -49,18 +49,27 @@ export class SectionPlaneDialogManager extends BaseDialogManager { this.panel = new SectionPlanePanel({ onHide: () => { console.log('[SectionPlaneDialogManager] 隐藏'); + if (this.registry.engine3d) { + (this.registry.engine3d as any).engine?.clipping?.disabled(); + } }, onReverse: () => { - console.log('[SectionPlaneDialogManager] 反向'); + console.log('[SectionPlaneDialogManager] 反向 (not supported in new API)'); }, onReset: () => { - console.log('[SectionPlaneDialogManager] 重置'); + console.log('[SectionPlaneDialogManager] 重置 (not supported in new API)'); } }); this.panel.init(); return this.panel.element; } + /** 对话框创建后的回调 */ + protected onDialogCreated(): void { + this.registry.engine3d?.activeSection('face'); + this.dialog?.fitHeight(false); + } + /** 对话框关闭时的回调 */ protected onDialogClose(): void { this.registry.toolbar?.setBtnActive('section-plane', false); @@ -68,6 +77,7 @@ export class SectionPlaneDialogManager extends BaseDialogManager { /** 销毁前的清理 */ protected onBeforeDestroy(): void { + this.registry.engine3d?.deactivateSection(); if (this.panel) { this.panel.destroy(); this.panel = null;