This commit is contained in:
Cay 2026-03-15 11:31:48 +00:00
parent 44ab3f31d8
commit 07c5c5efa7
2 changed files with 22 additions and 1 deletions

View File

@ -505,6 +505,13 @@ body {
transform: scale(1.1); transform: scale(1.1);
} }
#inv-left:disabled,
#inv-right:disabled {
opacity: 0.25;
cursor: not-allowed;
transform: none;
}
#inventory-nav { #inventory-nav {
display: flex; display: flex;
align-items: center; align-items: center;

View File

@ -63,9 +63,16 @@ export async function loadWohnhaus() {
<button id="inv-right">&#9658;</button> <button id="inv-right">&#9658;</button>
</div>`; </div>`;
// Variablen zurücksetzen beim Öffnen
inventoryPage = 0;
totalInventoryPages = 1;
inventoryItems = [];
// Buttons zuerst initialisieren
initInventoryButtons();
await loadInventory(); await loadInventory();
await loadEquipment(); await loadEquipment();
initInventoryButtons();
initDrag(); initDrag();
initSlotDrag(); initSlotDrag();
initDrop(); initDrop();
@ -143,6 +150,13 @@ function renderInventory() {
document.getElementById("inventory-page").innerText = document.getElementById("inventory-page").innerText =
"Seite " + (inventoryPage + 1) + " / " + totalInventoryPages; "Seite " + (inventoryPage + 1) + " / " + totalInventoryPages;
// Buttons aktivieren/deaktivieren
const btnLeft = document.getElementById("inv-left");
const btnRight = document.getElementById("inv-right");
if (btnLeft) btnLeft.disabled = inventoryPage === 0;
if (btnRight) btnRight.disabled = inventoryPage >= totalInventoryPages - 1;
initDrag(); initDrag();
} }