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