refactor(section-managers): adapt to unified clipping API

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)
This commit is contained in:
yuding
2026-02-02 16:25:32 +08:00
parent b36cc3edf3
commit 679d792de2
3 changed files with 19 additions and 10 deletions

View File

@@ -66,7 +66,7 @@ export class SectionAxisDialogManager extends BaseDialogManager {
}, },
onAxisChange: (axis) => { onAxisChange: (axis) => {
console.log('[SectionAxisDialogManager] 切换轴向:', axis); console.log('[SectionAxisDialogManager] 切换轴向:', axis);
this.registry.engine3d?.activateSectionAxis(axis); this.registry.engine3d?.activeSection(axis);
} }
}); });
this.panel.init(); this.panel.init();
@@ -84,7 +84,7 @@ export class SectionAxisDialogManager extends BaseDialogManager {
} }
// 自动激活默认轴向剖切X轴 // 自动激活默认轴向剖切X轴
this.registry.engine3d.activateSectionAxis('x'); this.registry.engine3d.activeSection('x');
} }
/** 对话框关闭时的回调,取消工具栏按钮激活状态 */ /** 对话框关闭时的回调,取消工具栏按钮激活状态 */
@@ -94,8 +94,7 @@ export class SectionAxisDialogManager extends BaseDialogManager {
/** 销毁前的清理,销毁面板实例 */ /** 销毁前的清理,销毁面板实例 */
protected onBeforeDestroy(): void { protected onBeforeDestroy(): void {
// 停用轴向剖切 this.registry.engine3d?.deactivateSection();
this.registry.engine3d?.deactivateSectionAxis();
if (this.panel) { if (this.panel) {
this.panel.destroy(); this.panel.destroy();

View File

@@ -65,10 +65,10 @@ export class SectionBoxDialogManager extends BaseDialogManager {
console.log('[SectionBoxDialogManager] 反向切换(底层暂不支持):', isReversed); console.log('[SectionBoxDialogManager] 反向切换(底层暂不支持):', isReversed);
}, },
onFitToModel: () => { onFitToModel: () => {
this.registry.engine3d?.fitSectionBoxToModel(); console.log('[SectionBoxDialogManager] Fit to model not supported in new API');
}, },
onReset: () => { onReset: () => {
this.registry.engine3d?.resetSectionBox(); console.log('[SectionBoxDialogManager] Reset not supported in new API');
}, },
onRangeChange: (range) => { onRangeChange: (range) => {
this.registry.engine3d?.setSectionBoxRange(range); this.registry.engine3d?.setSectionBoxRange(range);
@@ -80,7 +80,7 @@ export class SectionBoxDialogManager extends BaseDialogManager {
/** 对话框创建后的回调,激活剖切盒并自适应高度 */ /** 对话框创建后的回调,激活剖切盒并自适应高度 */
protected onDialogCreated(): void { protected onDialogCreated(): void {
this.registry.engine3d?.activateSectionBox(); this.registry.engine3d?.activeSection('box');
this.dialog?.fitHeight(false); this.dialog?.fitHeight(false);
} }
@@ -91,7 +91,7 @@ export class SectionBoxDialogManager extends BaseDialogManager {
/** 销毁前的清理,停用剖切盒并销毁面板实例 */ /** 销毁前的清理,停用剖切盒并销毁面板实例 */
protected onBeforeDestroy(): void { protected onBeforeDestroy(): void {
this.registry.engine3d?.deactivateSectionBox(); this.registry.engine3d?.deactivateSection();
if (this.panel) { if (this.panel) {
this.panel.destroy(); this.panel.destroy();
this.panel = null; this.panel = null;

View File

@@ -49,18 +49,27 @@ export class SectionPlaneDialogManager extends BaseDialogManager {
this.panel = new SectionPlanePanel({ this.panel = new SectionPlanePanel({
onHide: () => { onHide: () => {
console.log('[SectionPlaneDialogManager] 隐藏'); console.log('[SectionPlaneDialogManager] 隐藏');
if (this.registry.engine3d) {
(this.registry.engine3d as any).engine?.clipping?.disabled();
}
}, },
onReverse: () => { onReverse: () => {
console.log('[SectionPlaneDialogManager] 反向'); console.log('[SectionPlaneDialogManager] 反向 (not supported in new API)');
}, },
onReset: () => { onReset: () => {
console.log('[SectionPlaneDialogManager] 重置'); console.log('[SectionPlaneDialogManager] 重置 (not supported in new API)');
} }
}); });
this.panel.init(); this.panel.init();
return this.panel.element; return this.panel.element;
} }
/** 对话框创建后的回调 */
protected onDialogCreated(): void {
this.registry.engine3d?.activeSection('face');
this.dialog?.fitHeight(false);
}
/** 对话框关闭时的回调 */ /** 对话框关闭时的回调 */
protected onDialogClose(): void { protected onDialogClose(): void {
this.registry.toolbar?.setBtnActive('section-plane', false); this.registry.toolbar?.setBtnActive('section-plane', false);
@@ -68,6 +77,7 @@ export class SectionPlaneDialogManager extends BaseDialogManager {
/** 销毁前的清理 */ /** 销毁前的清理 */
protected onBeforeDestroy(): void { protected onBeforeDestroy(): void {
this.registry.engine3d?.deactivateSection();
if (this.panel) { if (this.panel) {
this.panel.destroy(); this.panel.destroy();
this.panel = null; this.panel = null;