- Add getHighlightModels() to retrieve selected models - Update hideSelectedModels → hideModels(models) - Update translucentSelectedModels → translucentModels(models) - Update isolateSelectedModels → isolateModels(models) - Update translucentOtherModels to accept models parameter - Update batch select methods to accept models parameter - Update right-click menu handlers to use new API pattern Tasks 7-9 completed from refactor-model-operations plan.
2.8 KiB
2.8 KiB
[2026-02-04] Tasks 7-9: EngineManager Layer + Right-Click Menu Updates
Changes Applied
File: src/managers/engine-manager.ts
1. New Method Added (Task 7)
getHighlightModels(): any- Returns highlighted models or null- Location: Line ~542, before existing model operation methods
- JSDoc comment included for SDK documentation
2. Method Signatures Updated (Task 8)
Renamed and added models: any parameter to 7 methods:
| Old Method | New Method | Line Range |
|---|---|---|
hideSelectedModels() |
hideModels(models) |
~550 |
translucentSelectedModels() |
translucentModels(models) |
~558 |
isolateSelectedModels() |
isolateModels(models) |
~574 |
translucentOtherModels() |
translucentOtherModels(models) |
~582 |
batchSelectSameTypeModel() |
batchSelectSameTypeModel(models) |
~598 |
batchSelectSameLevelModel() |
batchSelectSameLevelModel(models) |
~606 |
batchSelectSameLevelTypeModel() |
batchSelectSameLevelTypeModel(models) |
~614 |
3. Right-Click Menu Updated (Task 9)
Updated 7 onClick handlers in registerHandler callback (lines ~79-168):
Pattern applied:
// Before
onClick: () => {
this.methodName();
this.rightKey?.hide();
}
// After
onClick: () => {
const models = this.getHighlightModels();
if (models) {
this.methodName(models);
}
this.rightKey?.hide();
}
Updated menu items:
- hideSelected (line ~79)
- transparentSelected (line ~91)
- hideOthers (line ~120)
- transparentOthers (line ~128)
- selectSameType (line ~146)
- selectSameLevel (line ~154)
- selectSameLevelType (line ~162)
Code Pattern Established
Proxy methods pattern:
public methodName(models: any): void {
this.engineInstance?.methodName(models);
}
Right-click menu pattern:
const models = this.getHighlightModels();
if (models) {
this.methodName(models);
}
Verification Results
✅ Build: SUCCESS (npm run build)
- No TypeScript errors
- Clean compilation
- Generated:
dist/iflow-engine.es.js(2,096.85 kB) - Generated:
dist/iflow-engine.umd.js(1,380.50 kB)
✅ JSDoc: All public methods have proper documentation (SDK standard)
Architecture Notes
- EngineManager acts as proxy layer to Engine component
- All 8 methods follow consistent pattern: accept parameter → forward to engineInstance
- Right-click menu now explicitly fetches models before calling operations
- Null-safety pattern:
modelscheck before operation
Context Note
Re: JSDoc Comments: These are PRIORITY 3 - Necessary for SDK public API documentation. Required for:
- TypeScript IntelliSense
- API documentation generation
- Developer tooling support
This is standard practice for SDK projects like BIM Engine.