class DesignManager { constructor(app) { this.app = app; } // Save current design saveDesign() { const designData = { elements: this.app.designElements, timestamp: new Date().toISOString() }; console.log('Saving design:', designData); this.app.uiManager.showAlert('Design saved! (Check console for data)'); } // Create new design newDesign() { if (this.app.uiManager.showConfirmation('Are you sure you want to start a new design? This will clear the current design.')) { this.app.designElements = []; this.app.uiManager.clearSelection(); this.app.viewManager.switchTo2D(); // Switch to 2D and redraw // Clear and reset history this.app.historyManager.clear(); } } // Public methods for UI callbacks updateRoomName(name) { if (this.app.uiManager.updateRoomName(name)) { this.app.canvasDrawingManager.redraw(); } } updateWallThickness(thickness) { if (this.app.uiManager.updateWallThickness(thickness)) { this.app.canvasDrawingManager.redraw(); } } // Debug test method debugTest() { console.log('Running debug test...'); console.log('Current tool:', this.app.toolManager.getCurrentTool()); console.log('Canvas:', this.app.canvas); console.log('Context:', this.app.ctx); // Test direct canvas drawing this.app.ctx.fillStyle = 'blue'; this.app.ctx.fillRect(100, 100, 100, 50); console.log('Blue rectangle drawn'); // Test creating a wall element directly const testWall = { id: 'test-wall-' + Date.now(), type: 'wall', startX: 50, startY: 50, endX: 200, endY: 50, color: '#ff0000', material: 'brick', thickness: 10 }; this.app.designElements.push(testWall); console.log('Test wall added:', testWall); console.log('Design elements:', this.app.designElements); this.app.canvasDrawingManager.redraw(); } }