This commit is contained in:
Azgaar 2024-09-12 12:55:31 +02:00 committed by sofronaspe
parent 9f3e707b95
commit 1e0b4d6d94
4 changed files with 7 additions and 11 deletions

View file

@ -725,10 +725,7 @@ window.Routes = (function () {
}
pack.routes = pack.routes.filter(r => r.i !== route.i);
viewbox
.select("#routes")
.select("#route" + route.i)
.remove();
viewbox.select("#route" + route.i).remove();
}
return {

View file

@ -18,7 +18,7 @@ function editRouteGroups() {
// add listeners
byId("routeGroupsEditorAdd").addEventListener("click", addGroup);
byId("routeGroupsEditorBody").on("click", ev => {
const group = ev.target.parentNode.dataset.id;
const group = ev.target.closest(".states")?.dataset.id;
if (ev.target.classList.contains("editStyle")) editStyle("routes", group);
else if (ev.target.classList.contains("removeGroup")) removeGroup(group);
});
@ -72,12 +72,11 @@ function editRouteGroups() {
confirmationDialog({
title: "Remove route group",
message:
"Are you sure you want to remove the entire route group? All routes in this group will be removed. This action can't be reverted.",
"Are you sure you want to remove the entire route group? All routes in this group will be removed.<br>This action can't be reverted",
confirm: "Remove",
onConfirm: () => {
const routes = pack.routes.filter(r => r.group === group);
routes.forEach(r => Routes.remove(r));
if (DEFAULT_GROUPS.includes(group)) routes.select(`#${group}`).remove();
pack.routes.filter(r => r.group === group).forEach(Routes.remove);
if (!DEFAULT_GROUPS.includes(group)) routes.select(`#${group}`).remove();
addLines();
}
});