Skip to content

Commit

Permalink
fix layers error if don't exist when drag n drop
Browse files Browse the repository at this point in the history
  • Loading branch information
LPoin committed Dec 3, 2024
1 parent a12de65 commit 35f69b9
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions js/mviewerstudio.js
Original file line number Diff line number Diff line change
Expand Up @@ -554,12 +554,6 @@ function initializeNestedSortables() {
item.setAttribute("data-groupid", toGroupId);
item.setAttribute("data-themeid", toThemeId);

config.themes[toThemeId].layers.forEach((layer) => {
if (layer.id === item.getAttribute("data-layerid")) {
layer["data-groupid"] = toGroupId;
layer["data-themeid"] = toThemeId;
}
});
// Cherche l'index de départ en fonction de si le layer bougé vient d'un groupe ou un thème
const index = fromGroupId
? config.themes[fromThemeId].groups
Expand Down Expand Up @@ -593,6 +587,13 @@ function initializeNestedSortables() {
.layers.splice(newIndex, 0, itemToMove)
: config.themes[toThemeId].layers.splice(newIndex, 0, itemToMove);
}

config.themes[toThemeId].layers.forEach((layer) => {
if (layer.id === item.getAttribute("data-layerid")) {
layer["data-groupid"] = toGroupId;
layer["data-themeid"] = toThemeId;
}
});
},
});
// Marquer cet élément comme "initialisé" pour éviter les doublons
Expand Down

0 comments on commit 35f69b9

Please sign in to comment.