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.
This commit is contained in:
Erik 2026-03-13 07:23:35 +01:00
parent dc7b26676d
commit 4972b342d2
2 changed files with 25 additions and 3 deletions

View file

@ -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

View file

@ -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;