From 4972b342d212bdb1a595ef827440378a3b15ded6 Mon Sep 17 00:00:00 2001 From: Erik Date: Fri, 13 Mar 2026 07:23:35 +0100 Subject: [PATCH] fix: size inventory window to fit mana rows Grow the inventory window and mana panel dynamically based on tracked item count so all mana entries remain visible without introducing a scrollable panel. --- static/script.js | 21 +++++++++++++++++++++ static/style.css | 7 ++++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/static/script.js b/static/script.js index 517078fe..7a2b5c01 100644 --- a/static/script.js +++ b/static/script.js @@ -1533,6 +1533,7 @@ function renderInventoryManaPanel(state) { if (!state || !state.manaListBody || !state.manaSummary) return; const items = getManaTrackedItems(state); + adjustInventoryLayoutForMana(state, items.length); state.manaListBody.innerHTML = ''; if (items.length === 0) { @@ -1590,6 +1591,23 @@ function renderInventoryManaPanel(state) { }); } +function adjustInventoryLayoutForMana(state, itemCount) { + if (!state || !state.windowEl || !state.topSection || !state.manaPanel) return; + + const baseWindowHeight = 520; + const baseTopHeight = 264; + const basePanelHeight = 260; + const visibleRowsAtBase = 9; + const rowHeight = 22; + + const extraRows = Math.max(0, itemCount - visibleRowsAtBase); + const extraHeight = extraRows * rowHeight; + + state.topSection.style.height = `${baseTopHeight + extraHeight}px`; + state.manaPanel.style.height = `${basePanelHeight + extraHeight}px`; + state.windowEl.style.height = `${baseWindowHeight + extraHeight}px`; +} + function showInventoryWindow(name) { debugLog('showInventoryWindow called for:', name); const windowId = `inventoryWindow-${name}`; @@ -1730,8 +1748,10 @@ function showInventoryWindow(name) { }); win._inventoryState = { + windowEl: win, items: [], activePack: null, + topSection: topSection, slotMap: slotMap, equipGrid: equipGrid, itemGrid: itemGrid, @@ -1739,6 +1759,7 @@ function showInventoryWindow(name) { burdenFill: burdenFill, burdenLabel: burdenLabel, contentsHeader: contentsHeader, + manaPanel: manaPanel, manaSummary: manaSummary, manaListBody: manaListBody, characterName: name diff --git a/static/style.css b/static/style.css index dbd6d346..303e7c9e 100644 --- a/static/style.css +++ b/static/style.css @@ -761,7 +761,7 @@ body.noselect, body.noselect * { .inv-top-section { display: flex; justify-content: flex-start; - height: 264px; + min-height: 264px; gap: 10px; } @@ -959,7 +959,7 @@ body.noselect, body.noselect * { border: 1px solid var(--ac-border-light); padding: 3px; min-height: 0; - height: 260px; + min-height: 260px; flex-shrink: 0; overflow: hidden; } @@ -2433,6 +2433,7 @@ table.ts-allegiance td:first-child { background: #0e0c08 !important; resize: none !important; width: 548px !important; + min-height: 520px !important; } .inv-top-section { @@ -2448,7 +2449,7 @@ table.ts-allegiance td:first-child { .inv-mana-panel { width: 162px !important; min-width: 162px !important; - height: 260px !important; + min-height: 260px !important; background: #111014 !important; border: 1px solid #5a4a24 !important; overflow: hidden !important;