Skip to content

Commit

Permalink
fix(route-draw): route disappears if edited then quit. feat(route-dra…
Browse files Browse the repository at this point in the history
…w): add close btn when showing details
  • Loading branch information
azarz committed Dec 6, 2024
1 parent 26852e8 commit 96f1d16
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/css/route-draw.css
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
align-items: center;
justify-content: space-between;
position: relative;
margin: 0 10px 5px 0;
}

.routeDrawResultsTitle {
Expand Down
8 changes: 6 additions & 2 deletions src/js/my-account/my-account.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,11 @@ class MyAccount {
if (DOM.$fullScreenBtn.querySelector("button").classList.contains("maplibregl-ctrl-shrink")) {
return;
}
const routeId = this.map.queryRenderedFeatures(e.point, {layers: [MyAccountLayers["line-casing"].id]})[0].properties.id;
const visibleRoutes = this.map.queryRenderedFeatures(e.point, {layers: [MyAccountLayers["line-casing"].id]}).filter((route) => route.properties.visible);
if (visibleRoutes.length === 0) {
return;
}
const routeId = visibleRoutes[0].properties.id;
const route = this.routes.filter( route => route.id == routeId)[0];
if (route.visible) {
this.showRouteDetails(route);
Expand Down Expand Up @@ -1130,7 +1134,7 @@ ${props.text}`,
try {
const route = this.#getRouteFromID(routeId);
if (!route.visible) {
this.toggleShowRoute();
this.toggleShowRoute(route);
}
} catch (e) {
console.warn(e);
Expand Down
10 changes: 6 additions & 4 deletions src/js/route-draw/route-draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -1137,18 +1137,20 @@ class RouteDraw {
this.dom.changeMode.classList.add("d-none");
this.dom.titlewrapper.classList.remove("d-none");
Globals.menu.open("routeDraw");

DOM.$tabClose.classList.remove("d-none");
}

/**
* ferme le menu des résultats du calcul
* @public
*/
hide() {
Globals.menu.close("routeDraw");
if (this.routeId !== null) {
Globals.myaccount.showRouteFromID(this.routeId);
const routeId = this.routeId;
if (routeId !== null) {
console.log(routeId);
Globals.myaccount.showRouteFromID(routeId);
}
Globals.menu.close("routeDraw");
}
}

Expand Down

0 comments on commit 96f1d16

Please sign in to comment.