Skip to content

Commit f115c72

Browse files
committed
fix(routedraw): better edition of imported routes
1 parent 0b8bfed commit f115c72

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

src/js/my-account/my-account.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class MyAccount {
119119
this.map.addImage("compare-landmark-yellow", image.data);
120120
});
121121

122-
// REMOVEME : rétrocompatibilité des entités enregistrées : migration de préférences à fichier local (post-3.3.35)
122+
// REMOVEME : rétrocompatibilité des entités enregistrées : migration de préférences à fichier local (post-3.4.5)
123123
// récupération des itinéraires enregistrés en local
124124
let promiseRoutes = Preferences.get( { key: "savedRoutes"} ).then( (resp) => {
125125
if (resp.value) {

src/js/route-draw/route-draw.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,11 @@ class RouteDraw {
251251
}
252252
this.#saveState();
253253
DOM.$routeDrawCancel.classList.add("inactive");
254+
if (this.data.isTrack) {
255+
this.changeMode(0);
256+
} else {
257+
this.changeMode(1);
258+
}
254259
this.__updateRouteInfo(this.data);
255260
this.#updateSources();
256261
}
@@ -606,19 +611,17 @@ class RouteDraw {
606611
this.#updateSources();
607612
var promises = [];
608613
if (index > 0) {
609-
const mode = this.data.steps[index - 1] ? this.data.steps[index - 1].properties.mode : this.mode;
610-
const computeBefore = this.#computeStep(index - 1, mode, false);
614+
const computeBefore = this.#computeStep(index - 1, this.mode, false);
611615
promises.push(computeBefore);
612-
if (this.mode === 1 && this.data.steps[index - 1].properties.mode === 0 && index > 1) {
613-
computeBefore.then(() => promises.push(this.#computeStep(index - 2, this.data.steps[index - 2].properties.mode, false)));
616+
if (this.mode === 1 && index > 1) {
617+
computeBefore.then(() => promises.push(this.#computeStep(index - 2, 0, false)));
614618
}
615619
}
616620
if (index < this.data.points.length - 1) {
617-
const mode = this.data.steps[index] ? this.data.steps[index].properties.mode : this.mode;
618-
const computeAfter = this.#computeStep(index, mode, false);
621+
const computeAfter = this.#computeStep(index, this.mode, false);
619622
promises.push(computeAfter);
620-
if (this.mode === 1 && index < this.data.points.length - 2 && this.data.steps[index].properties.mode === 0) {
621-
computeAfter.then(() => promises.push(this.#computeStep(index + 1, this.data.steps[index + 1].properties.mode, false)));
623+
if (this.mode === 1 && index < this.data.points.length - 2) {
624+
computeAfter.then(() => promises.push(this.#computeStep(index + 1, 0, false)));
622625
}
623626
}
624627
Promise.all(promises).then(() => {

0 commit comments

Comments
 (0)