Add ability to edit existing custom layouts

Implemented layout editing functionality with selection UI:

Features:
- New layout selector dialog when pressing Super+Shift+E
- Lists all existing custom layouts with zone counts
- "Create New Layout" option for new layouts
- Click any layout to edit it in the zone editor
- Existing zones pre-populated when editing
- Updates existing layout when saving (shows "updated" message)
- ESC key or Cancel button to close selector

Implementation details:
- Added editingLayoutId and editingLayoutName properties to track edit mode
- Modified startEditor() to accept optional layoutId and layoutData parameters
- Created showLayoutSelector() method to display layout selection UI
- Created _createZoneActorsFromData() to pre-populate zones when editing
- Updated _saveLayout() to update existing layout vs create new
- Changed keybinding to call showLayoutSelector() instead of startEditor()
- Added _closeLayoutSelector() for cleanup
- Deep copy of zones array to avoid reference issues

User experience:
- Press Super+Shift+E to open layout selector
- Choose existing layout to edit or create new
- Edit zones (move, resize, add, delete)
- Save updates existing layout or creates new
- Clear visual feedback for edit vs create mode

Fixes TODO item #5.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-15 21:40:57 -07:00
parent ee2f4792ac
commit 7816d41571
2 changed files with 250 additions and 19 deletions

10
TODO.md
View File

@@ -36,12 +36,12 @@
- [ ] Verify zone calculations work correctly with display scaling
- [ ] May need to use `get_resource_scale()` or similar
### 5. Edit Existing Custom Layouts
### 5. Edit Existing Custom Layouts ✅ COMPLETED
**Priority: Medium**
- [ ] Currently can only create new layouts in editor
- [ ] Add ability to select and edit existing custom layouts
- [ ] Add UI to choose which layout to edit
- [ ] Pre-populate editor with existing zones when editing
- [x] Currently can only create new layouts in editor
- [x] Add ability to select and edit existing custom layouts
- [x] Add UI to choose which layout to edit
- [x] Pre-populate editor with existing zones when editing
### 15. Show Zone Dimensions in Editor ✅ COMPLETED
**Priority: Medium**