fix: auto-arrange now correctly recalculates widget grid layouts
Root Cause: After auto-arrange reorganized widgets, code attempted to call onResize() for ALL tabs' widgets. However, switchTab() clears the this.widgets Map and only re-renders the current tab. Result: this.widgets.get(widgetId) returned undefined for non-active tabs, so onResize() was never called. Additionally, User Attributes onResize() was receiving grid units (2) instead of pixel width (~290px), causing calculateOptimalColumns() to think only 2 columns would fit when 3 columns could easily fit. The Fix: 1. Iterate over this.widgets Map (currently rendered widgets only) instead of this.dashboard.tabs (includes non-rendered widgets) 2. Use container.offsetWidth (pixel width) in onResize instead of grid units 3. Enable DEBUG flags temporarily to reveal previously suppressed logs Result: - onResize() now called for all visible widgets after auto-arrange - User Attributes correctly maintains 3×3 grid at 2 grid units wide - No more 2×5 layout with orphaned last attribute Fixes: User Attributes breaking into 2×5 grid after auto-arrange
This commit is contained in:
@@ -296,7 +296,6 @@ function setupDashboardEventListeners(dependencies) {
|
||||
});
|
||||
|
||||
if (confirmed) {
|
||||
console.log('[RPG Companion] Auto-layout button clicked');
|
||||
dashboardManager.autoLayoutWidgets();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user