This commit is contained in:
Cay 2026-03-13 18:12:09 +00:00
parent 0745a27a15
commit a9896062f9

View File

@ -72,7 +72,9 @@ async function loadEquipment() {
const label = slot.querySelector(".slot-label");
slot.innerHTML = `<img src="${item.icon}">`;
slot.innerHTML = `<img src="${item.icon}" draggable="true">`;
initSlotDrag();
if (label) {
slot.appendChild(label);
@ -199,11 +201,9 @@ function initDrop() {
}
function initSlotDrag() {
document.querySelectorAll(".slot").forEach((slot) => {
slot.addEventListener("dragstart", (e) => {
const img = slot.querySelector("img");
if (!img) return;
document.querySelectorAll(".slot img").forEach((img) => {
img.addEventListener("dragstart", (e) => {
const slot = img.closest(".slot");
e.dataTransfer.setData("icon", img.src);
e.dataTransfer.setData("fromSlot", slot.dataset.slot);