efficient reordering is fully functional!! :)

This commit is contained in:
2025-07-16 11:18:46 -04:00
parent 597e995f89
commit a6fecaaa44
+7 -2
View File
@@ -1926,6 +1926,10 @@
document.getElementById("containers").insertAdjacentElement("beforeend", clickedListingCopy); document.getElementById("containers").insertAdjacentElement("beforeend", clickedListingCopy);
} }
console.log("current" + currentIndex);
console.log("destination" + destinationIndex);
console.log("zindexmap BEFORE: ", zIndexMap);
let destinationContainer = containerDataMap.get(zIndexMap.get(destinationIndex)); let destinationContainer = containerDataMap.get(zIndexMap.get(destinationIndex));
// swap container z-indexes // swap container z-indexes
@@ -1933,11 +1937,12 @@
document.getElementById(containerId).style.zIndex = destinationIndex; document.getElementById(containerId).style.zIndex = destinationIndex;
// save changes to map // save changes to map
zIndexMap.set(currentIndex, zIndexMap.get(destinationIndex)); zIndexMap.set(String(currentIndex), zIndexMap.get(destinationIndex));
zIndexMap.set(destinationIndex, movingContainer.id); zIndexMap.set(destinationIndex, movingContainer.id);
// save new indexes direcly to affected containers console.log("zindexmap AFTER: ", zIndexMap);
// save new indexes direcly to affected containers
movingContainer.containerSettings.zIndex = destinationIndex; movingContainer.containerSettings.zIndex = destinationIndex;
movingContainer.addSettingsMenuEventListeners(); movingContainer.addSettingsMenuEventListeners();