feat(clipping): implement hide/recover toggle for all section dialogs
Update all three section dialogs to support hide/show toggle: SectionAxisDialogManager: - onHideToggle now calls hideSection()/recoverSection() SectionBoxDialogManager: - onHideToggle now calls hideSection()/recoverSection() SectionPlanePanel: - Add isHidden state tracking - Change onHide to onHideToggle(isHidden) - Add setHiddenState/getHiddenState methods - Update button to toggle active state SectionPlaneDialogManager: - Switch to onHideToggle callback - Call hideSection()/recoverSection() based on toggle state Behavior: Click hide button to hide section, click again to recover.
This commit is contained in:
151
.sisyphus/notepads/clipping-api-migration/learnings.md
Normal file
151
.sisyphus/notepads/clipping-api-migration/learnings.md
Normal file
@@ -0,0 +1,151 @@
|
||||
|
||||
## [2026-02-02] Task 1 - Engine Component Refactoring Complete
|
||||
|
||||
**What was done**:
|
||||
- Replaced old state variables (`currentSectionAxis`, `isSectionBoxActive`) with unified `currentSectionMode`
|
||||
- Removed all old clipping methods (~175 lines):
|
||||
- `activateSectionAxis()`, `deactivateSectionAxis()`, `deactivateCurrentSectionAxis()`, `getCurrentSectionAxis()`
|
||||
- `activateSectionBox()`, `deactivateSectionBox()`, `fitSectionBoxToModel()`, `resetSectionBox()`
|
||||
- Implemented new unified API (4 methods, ~38 lines):
|
||||
- `activeSection(mode)` - unified activation using `engine.clipping.active(mode)`
|
||||
- `getCurrentSectionMode()` - getter for current mode
|
||||
- `setSectionBoxRange(range)` - using `engine.clipping.updateClippingValue(range)`
|
||||
- `deactivateSection()` - unified deactivation using `engine.clipping.disActive()`
|
||||
|
||||
**Key Implementation Details**:
|
||||
- `activeSection()` uses new underlying API: `this.engine.clipping.active(mode)`
|
||||
- `setSectionBoxRange()` uses `updateClippingValue()` instead of old `sectionBox.setboxPercent()`
|
||||
- SectionBoxRange type already imported from `../section-box-panel/types`
|
||||
- Maintained existing comment style and section delimiters
|
||||
|
||||
**Verification**:
|
||||
- TypeScript errors now ONLY in EngineManager (expected - Task 2 will fix)
|
||||
- No errors in Engine component itself
|
||||
- Ready for Task 2
|
||||
|
||||
**Line count reduction**: ~175 lines → ~38 lines (77% reduction in clipping code)
|
||||
|
||||
## [2026-02-02] Task 2 - EngineManager Refactoring Complete
|
||||
|
||||
**What was done**:
|
||||
- Removed old methods:
|
||||
- `activateSectionAxis()`, `deactivateSectionAxis()`, `getCurrentSectionAxis()`
|
||||
- `activateSectionBox()`, `deactivateSectionBox()`
|
||||
- `fitSectionBoxToModel()`, `resetSectionBox()`
|
||||
- Added new unified methods:
|
||||
- `activeSection(mode)` - delegates to `engineInstance.activeSection(mode)`
|
||||
- `getCurrentSectionMode()` - delegates to `engineInstance.getCurrentSectionMode()`
|
||||
- Kept existing methods:
|
||||
- `deactivateSection()` - already present
|
||||
- `setSectionBoxRange()` - already present
|
||||
|
||||
**Line count reduction**: ~78 lines → ~27 lines (65% reduction)
|
||||
|
||||
**Next errors**: Now in Dialog Managers (Tasks 3, 4, 5) - as expected
|
||||
|
||||
## [2026-02-02] Tasks 3, 4, 5 - Dialog Managers Adaptation Complete
|
||||
|
||||
**Task 3 - SectionAxisDialogManager**:
|
||||
- Changed `activateSectionAxis(axis)` → `activeSection(axis)` in onAxisChange callback
|
||||
- Changed initial activation in onDialogCreated from `activateSectionAxis('x')` → `activeSection('x')`
|
||||
|
||||
**Task 4 - SectionBoxDialogManager**:
|
||||
- Changed `activateSectionBox()` → `activeSection('box')` in onDialogCreated
|
||||
- Replaced `fitSectionBoxToModel()` and `resetSectionBox()` with console.log (not supported)
|
||||
- Kept `setSectionBoxRange()` callback (still works)
|
||||
|
||||
**Task 5 - SectionPlaneDialogManager**:
|
||||
- Added `onDialogCreated()` lifecycle method with `activeSection('face')` call
|
||||
- Added `onBeforeDestroy()` lifecycle method with `deactivateSection()` call
|
||||
- Updated `onHide` callback to call `engine.clipping.disabled()` directly (temporary workaround)
|
||||
- Kept `onReverse` and `onReset` as console.log only (not supported in new API)
|
||||
|
||||
**TypeScript Verification**: ✅ CLEAN - `npx tsc --noEmit` exit code 0
|
||||
|
||||
**Ready for**: Task 6 (Documentation)
|
||||
|
||||
## [2026-02-02] Task 6 - Documentation Update Complete
|
||||
|
||||
**Files updated**:
|
||||
1. `docs/引擎API对接.md`:
|
||||
- Updated DialogManager examples to use `activeSection()` and `deactivateSection()`
|
||||
- Updated EngineManager API reference with new unified methods
|
||||
- Updated Engine component examples showing new API signatures
|
||||
- Removed references to deprecated methods (fitSectionBoxToModel, resetSectionBox)
|
||||
|
||||
2. `docs/API调用链.md`:
|
||||
- Updated axial clipping flow charts to show `activeSection('x'|'y'|'z')`
|
||||
- Updated section box flow charts to show `activeSection('box')`
|
||||
- Replaced axis lookup table with unified mode table (x, y, z, box, face)
|
||||
- Marked fitSectionBoxToModel and resetSectionBox as deprecated
|
||||
- Updated all API method references throughout
|
||||
|
||||
**Key changes in documentation**:
|
||||
- Old: `activateSectionAxis(axis)` → New: `activeSection(axis)`
|
||||
- Old: `activateSectionBox()` → New: `activeSection('box')`
|
||||
- Old: `deactivateSectionAxis()` / `deactivateSectionBox()` → New: `deactivateSection()`
|
||||
- Old: `getCurrentSectionAxis()` → New: `getCurrentSectionMode()`
|
||||
- Old: `engine.clipping.sectionBox.setboxPercent()` → New: `engine.clipping.updateClippingValue()`
|
||||
|
||||
**Ready for**: Task 7 (Final Verification)
|
||||
|
||||
## [2026-02-02] Task 7 - Final Verification Complete
|
||||
|
||||
**Build Verification**: ✅ PASSED
|
||||
```
|
||||
npm run build
|
||||
✓ TypeScript compilation successful
|
||||
✓ Vite build successful (5.59s)
|
||||
✓ Output: dist/iflow-engine.es.js (2,059.34 kB)
|
||||
✓ Output: dist/iflow-engine.umd.js (1,359.09 kB)
|
||||
```
|
||||
|
||||
**Source Code Verification**: ✅ CLEAN
|
||||
- Searched entire `src/` directory for old API references
|
||||
- Result: NO occurrences of:
|
||||
- `activateSectionAxis`
|
||||
- `activateSectionBox`
|
||||
- `deactivateSectionAxis`
|
||||
- `deactivateSectionBox`
|
||||
- `fitSectionBoxToModel`
|
||||
- `resetSectionBox`
|
||||
- `getCurrentSectionAxis`
|
||||
|
||||
**TypeScript Verification**: ✅ PASSED
|
||||
- `npx tsc --noEmit` exit code: 0
|
||||
- No TypeScript errors in any file
|
||||
|
||||
**Migration Summary**:
|
||||
| Component | Old API Lines | New API Lines | Reduction |
|
||||
|-----------|---------------|---------------|-----------|
|
||||
| Engine | ~175 | ~38 | 78% |
|
||||
| EngineManager | ~78 | ~27 | 65% |
|
||||
| SectionAxisDialogManager | Modified 2 locations | - | - |
|
||||
| SectionBoxDialogManager | Modified 3 locations | - | - |
|
||||
| SectionPlaneDialogManager | Added 2 lifecycle methods | - | - |
|
||||
|
||||
**Total Impact**:
|
||||
- Files modified: 5 code files + 2 documentation files
|
||||
- Lines removed: ~253 lines of old clipping code
|
||||
- Lines added: ~65 lines of new unified API
|
||||
- Net reduction: ~188 lines (74% code reduction in clipping functionality)
|
||||
|
||||
**ALL TASKS COMPLETE** ✅
|
||||
|
||||
## [2026-02-02] PLAN COMPLETION - All 20 Checkboxes Verified
|
||||
|
||||
**Status**: ✅ 20/20 COMPLETE (100%)
|
||||
|
||||
**Breakdown**:
|
||||
- 7 main tasks (Tasks 1-7): COMPLETE
|
||||
- 5 Definition of Done criteria: VERIFIED
|
||||
- 8 Final Checklist items: VERIFIED
|
||||
|
||||
**Evidence**:
|
||||
- Build successful: `npm run build` ✅
|
||||
- TypeScript clean: `npx tsc --noEmit` exit 0 ✅
|
||||
- No old API references: grep search clean ✅
|
||||
- Documentation updated: 2 files modified ✅
|
||||
- Code committed: 4 atomic commits ✅
|
||||
|
||||
**Outcome**: Clipping API migration is 100% complete and verified.
|
||||
Reference in New Issue
Block a user