pop33
This commit is contained in:
parent
b4ab9030fb
commit
2b7950803f
@ -251,7 +251,9 @@ data-level="${itemLevel}">
|
||||
function initInventoryDrop() {
|
||||
const grid = document.getElementById("inventory-grid");
|
||||
|
||||
grid.addEventListener("dragover", (e) => e.preventDefault());
|
||||
grid.addEventListener("dragover", (e) => {
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
grid.addEventListener("drop", (e) => {
|
||||
e.preventDefault();
|
||||
@ -266,10 +268,14 @@ function initInventoryDrop() {
|
||||
|
||||
const slot = document.querySelector('.slot[data-slot="' + slotName + '"]');
|
||||
|
||||
if (!slot) return;
|
||||
|
||||
const img = slot.querySelector("img");
|
||||
|
||||
if (!img) return;
|
||||
|
||||
/* neues Inventar Item */
|
||||
|
||||
const newItem = document.createElement("div");
|
||||
|
||||
newItem.classList.add("inventory-slot");
|
||||
@ -289,11 +295,16 @@ function initInventoryDrop() {
|
||||
|
||||
slot.innerHTML = "";
|
||||
|
||||
if (label) slot.appendChild(label);
|
||||
if (label) {
|
||||
slot.appendChild(label);
|
||||
}
|
||||
|
||||
slot.classList.remove("has-item");
|
||||
|
||||
/* Drag wieder aktivieren */
|
||||
|
||||
initDrag();
|
||||
initSlotDrag();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user