pop29
This commit is contained in:
parent
0745a27a15
commit
a9896062f9
@ -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);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user