refactor(engine-manager): update clipping API to unified activeSection

- Add activeSection(mode) method
- Add getCurrentSectionMode() method
- Remove deprecated methods: activateSectionAxis, activateSectionBox, etc.
- Keep deactivateSection() and setSectionBoxRange()
- Code reduction: ~78 lines → ~27 lines (65% reduction)
This commit is contained in:
yuding
2026-02-02 16:25:27 +08:00
parent 76da6cf3ac
commit b36cc3edf3

View File

@@ -258,53 +258,28 @@ export class EngineManager extends BaseManager {
* 激活轴向剖切 * 激活轴向剖切
* @param axis 要激活的轴向 ('x' | 'y' | 'z') * @param axis 要激活的轴向 ('x' | 'y' | 'z')
*/ */
public activateSectionAxis(axis: 'x' | 'y' | 'z'): void { public activeSection(mode: 'x' | 'y' | 'z' | 'box' | 'face'): void {
if (!this.engineInstance) { if (!this.engineInstance) {
console.warn('[EngineManager] 3D Engine not initialized.'); console.warn('[EngineManager] 3D Engine not initialized.');
return; return;
} }
this.engineInstance.activateSectionAxis(axis); this.engineInstance.activeSection(mode);
} }
/** public getCurrentSectionMode(): 'x' | 'y' | 'z' | 'box' | 'face' | null {
* 停用轴向剖切
*/
public deactivateSectionAxis(): void {
if (!this.engineInstance) {
return;
}
this.engineInstance.deactivateSectionAxis();
}
/**
* 获取当前剖切轴向
* @returns 当前激活的轴向
*/
public getCurrentSectionAxis(): 'x' | 'y' | 'z' | null {
if (!this.engineInstance) { if (!this.engineInstance) {
return null; return null;
} }
return this.engineInstance.getCurrentSectionAxis(); return this.engineInstance.getCurrentSectionMode();
} }
/** 激活剖切盒 */ public deactivateSection(): void {
public activateSectionBox(): void {
if (!this.engineInstance) {
console.warn('[EngineManager] 3D Engine not initialized.');
return;
}
this.engineInstance.activateSectionBox();
}
/** 停用剖切盒 */
public deactivateSectionBox(): void {
if (!this.engineInstance) { if (!this.engineInstance) {
return; return;
} }
this.engineInstance.deactivateSectionBox(); this.engineInstance.deactivateSection();
} }
/** 设置剖切盒范围(百分比 0-100 */
public setSectionBoxRange(range: SectionBoxRange): void { public setSectionBoxRange(range: SectionBoxRange): void {
if (!this.engineInstance) { if (!this.engineInstance) {
console.warn('[EngineManager] 3D Engine not initialized.'); console.warn('[EngineManager] 3D Engine not initialized.');
@@ -313,23 +288,6 @@ export class EngineManager extends BaseManager {
this.engineInstance.setSectionBoxRange(range); this.engineInstance.setSectionBoxRange(range);
} }
/** 适应剖切盒到模型 */
public fitSectionBoxToModel(): void {
if (!this.engineInstance) {
console.warn('[EngineManager] 3D Engine not initialized.');
return;
}
this.engineInstance.fitSectionBoxToModel();
}
/** 重置剖切盒 */
public resetSectionBox(): void {
if (!this.engineInstance) {
return;
}
this.engineInstance.resetSectionBox();
}
/** 激活框选放大功能 */ /** 激活框选放大功能 */
public activateZoomBox(): void { public activateZoomBox(): void {
if (!this.engineInstance) { if (!this.engineInstance) {