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:
parent
dc7b26676d
commit
4972b342d2
2 changed files with 25 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue