refactor: sync managers and section box actions
Wire section box scale/reverse/reset to clipping APIs and sync demo artifacts.
This commit is contained in:
109
.sisyphus/notepads/right-click-menu-functions/learnings.md
Normal file
109
.sisyphus/notepads/right-click-menu-functions/learnings.md
Normal file
@@ -0,0 +1,109 @@
|
||||
|
||||
## [2026-02-03T09:55] Task 1: I18n Files Update
|
||||
|
||||
### Pattern Observed
|
||||
- All menu i18n keys use JSDoc comments with Chinese descriptions in types.ts
|
||||
- Format: `/** 中文描述 */\n{key}: string;`
|
||||
- This is a codebase convention for bilingual documentation
|
||||
|
||||
### Implementation
|
||||
- Added 4 fields to menu object: quickSelect, selectSameType, selectSameLevel, selectSameLevelType
|
||||
- Maintained alphabetical ordering after existing fields
|
||||
- Chinese: 快速选择, 选择同类模型, 选择同层模型, 选择同层同类模型
|
||||
- English: Quick Select, Select Same Type, Select Same Level, Select Same Level & Type
|
||||
|
||||
### Verification
|
||||
- tsc --noEmit passed with no errors
|
||||
- All three files updated consistently
|
||||
|
||||
## [2026-02-03T09:58] Task 2: Engine Layer Methods
|
||||
|
||||
### Implementation
|
||||
- Added 8 public methods to Engine class between lines 792-903
|
||||
- Pattern: check initialization → get highlightModels → call engine.modelToolModule API
|
||||
- Section markers: `// ==================== 构件操作 ====================`
|
||||
- Each method has JSDoc with Chinese description (SDK convention)
|
||||
|
||||
### API Mapping
|
||||
```
|
||||
hideSelectedModels() → modelToolModule.hideModel(models)
|
||||
translucentSelectedModels() → modelToolModule.translucentModel(models)
|
||||
isolateSelectedModels() → modelToolModule.isolateModel(models)
|
||||
translucentOtherModels() → modelToolModule.translucentOtherModel(models)
|
||||
showAllModels() → modelToolModule.showAllModels()
|
||||
batchSelectSameTypeModel() → modelToolModule.batchSelectSameTypeModel(models)
|
||||
batchSelectSameLevelModel() → modelToolModule.batchSelectSameLevelModel(models)
|
||||
batchSelectSameLevelTypeModel() → modelToolModule.batchSelectSameLevelTypeModel(models)
|
||||
```
|
||||
|
||||
### Verification
|
||||
- TypeScript compilation: PASSED
|
||||
- Methods follow existing patterns (fitSectionBoxToModel as reference)
|
||||
- Positioned correctly before destroy() method
|
||||
|
||||
## [2026-02-03T10:00] Task 3: EngineManager Proxy Methods
|
||||
|
||||
### Implementation
|
||||
- Added 8 proxy methods to EngineManager class (lines 494-555)
|
||||
- Pattern: Simple delegation to engineInstance methods using optional chaining
|
||||
- Format: `this.engineInstance?.{methodName}();`
|
||||
- Each method has JSDoc with Chinese description
|
||||
|
||||
### Verification
|
||||
- TypeScript compilation: PASSED
|
||||
- All 8 methods correctly delegate to Engine layer
|
||||
- Positioned between path roaming and destroy() method
|
||||
|
||||
## [2026-02-03T10:03] Task 4: Right-Click Menu Handler Updates
|
||||
|
||||
### Implementation
|
||||
- Replaced all console.log placeholders with actual method calls
|
||||
- Added "快速选择" submenu with 3 options (order: 5)
|
||||
- Updated menu item ordering:
|
||||
- isolateSelected: order 4 (unchanged)
|
||||
- quickSelect: order 5 (NEW)
|
||||
- fitSectionBox: order 5 → 6
|
||||
- showAll: order 6 → 7
|
||||
|
||||
### Menu Structure
|
||||
```
|
||||
1. 构件详情 (componentDetail)
|
||||
2. 隐藏选中构件 (hideSelected) → hideSelectedModels()
|
||||
3. 半透明选中构件 (transparentSelected) → translucentSelectedModels()
|
||||
4. 隔离选中构件 (isolateSelected) → SUBMENU
|
||||
- 其他构件隐藏 (hideOthers) → isolateSelectedModels()
|
||||
- 其他构件半透明 (transparentOthers) → translucentOtherModels()
|
||||
5. 快速选择 (quickSelect) → SUBMENU [NEW]
|
||||
- 选择同类模型 (selectSameType) → batchSelectSameTypeModel()
|
||||
- 选择同层模型 (selectSameLevel) → batchSelectSameLevelModel()
|
||||
- 选择同层同类模型 (selectSameLevelType) → batchSelectSameLevelTypeModel()
|
||||
6. 剖切盒适应 (fitSectionBox) → fitSectionBoxToModel()
|
||||
7. 显示全部 (showAll) → showAllModels() [always visible]
|
||||
```
|
||||
|
||||
### Verification
|
||||
- TypeScript compilation: PASSED
|
||||
- All console.log placeholders replaced
|
||||
- All i18n keys properly linked to translations
|
||||
|
||||
## [2026-02-03T10:05] Task 5: Build & Commit
|
||||
|
||||
### Build Verification
|
||||
- Command: `npm run build`
|
||||
- Result: SUCCESS
|
||||
- Output size: 2,084.68 kB (ES), 1,374.53 kB (UMD)
|
||||
- Build time: 4.06s
|
||||
|
||||
### Commit
|
||||
- Hash: 89783d0
|
||||
- Message: "feat(menu): implement right-click menu functions for model operations"
|
||||
- Files staged: 5 (types.ts, zh-CN.ts, en-US.ts, engine/index.ts, engine-manager.ts)
|
||||
- Stats: 551 insertions(+), 118 deletions(-)
|
||||
|
||||
### Summary
|
||||
All 5 tasks completed successfully:
|
||||
1. ✅ I18n files updated (4 new fields)
|
||||
2. ✅ Engine layer: 8 methods added
|
||||
3. ✅ EngineManager: 8 proxy methods added
|
||||
4. ✅ Right-click menu handler: All functions connected + quick select submenu
|
||||
5. ✅ Build verification: PASSED
|
||||
Reference in New Issue
Block a user