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;
|
if (!state || !state.manaListBody || !state.manaSummary) return;
|
||||||
|
|
||||||
const items = getManaTrackedItems(state);
|
const items = getManaTrackedItems(state);
|
||||||
|
adjustInventoryLayoutForMana(state, items.length);
|
||||||
state.manaListBody.innerHTML = '';
|
state.manaListBody.innerHTML = '';
|
||||||
|
|
||||||
if (items.length === 0) {
|
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) {
|
function showInventoryWindow(name) {
|
||||||
debugLog('showInventoryWindow called for:', name);
|
debugLog('showInventoryWindow called for:', name);
|
||||||
const windowId = `inventoryWindow-${name}`;
|
const windowId = `inventoryWindow-${name}`;
|
||||||
|
|
@ -1730,8 +1748,10 @@ function showInventoryWindow(name) {
|
||||||
});
|
});
|
||||||
|
|
||||||
win._inventoryState = {
|
win._inventoryState = {
|
||||||
|
windowEl: win,
|
||||||
items: [],
|
items: [],
|
||||||
activePack: null,
|
activePack: null,
|
||||||
|
topSection: topSection,
|
||||||
slotMap: slotMap,
|
slotMap: slotMap,
|
||||||
equipGrid: equipGrid,
|
equipGrid: equipGrid,
|
||||||
itemGrid: itemGrid,
|
itemGrid: itemGrid,
|
||||||
|
|
@ -1739,6 +1759,7 @@ function showInventoryWindow(name) {
|
||||||
burdenFill: burdenFill,
|
burdenFill: burdenFill,
|
||||||
burdenLabel: burdenLabel,
|
burdenLabel: burdenLabel,
|
||||||
contentsHeader: contentsHeader,
|
contentsHeader: contentsHeader,
|
||||||
|
manaPanel: manaPanel,
|
||||||
manaSummary: manaSummary,
|
manaSummary: manaSummary,
|
||||||
manaListBody: manaListBody,
|
manaListBody: manaListBody,
|
||||||
characterName: name
|
characterName: name
|
||||||
|
|
|
||||||
|
|
@ -761,7 +761,7 @@ body.noselect, body.noselect * {
|
||||||
.inv-top-section {
|
.inv-top-section {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
height: 264px;
|
min-height: 264px;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -959,7 +959,7 @@ body.noselect, body.noselect * {
|
||||||
border: 1px solid var(--ac-border-light);
|
border: 1px solid var(--ac-border-light);
|
||||||
padding: 3px;
|
padding: 3px;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
height: 260px;
|
min-height: 260px;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
@ -2433,6 +2433,7 @@ table.ts-allegiance td:first-child {
|
||||||
background: #0e0c08 !important;
|
background: #0e0c08 !important;
|
||||||
resize: none !important;
|
resize: none !important;
|
||||||
width: 548px !important;
|
width: 548px !important;
|
||||||
|
min-height: 520px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.inv-top-section {
|
.inv-top-section {
|
||||||
|
|
@ -2448,7 +2449,7 @@ table.ts-allegiance td:first-child {
|
||||||
.inv-mana-panel {
|
.inv-mana-panel {
|
||||||
width: 162px !important;
|
width: 162px !important;
|
||||||
min-width: 162px !important;
|
min-width: 162px !important;
|
||||||
height: 260px !important;
|
min-height: 260px !important;
|
||||||
background: #111014 !important;
|
background: #111014 !important;
|
||||||
border: 1px solid #5a4a24 !important;
|
border: 1px solid #5a4a24 !important;
|
||||||
overflow: hidden !important;
|
overflow: hidden !important;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue