Skip to content

Commit

Permalink
fix(search): mylocation not working as expected
Browse files Browse the repository at this point in the history
  • Loading branch information
azarz committed Feb 15, 2024
1 parent 44f8687 commit 369fbe7
Showing 1 changed file with 26 additions and 27 deletions.
53 changes: 26 additions & 27 deletions src/js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,35 +104,34 @@ class Search {
}, true);

document.getElementById(id.myLoc).addEventListener("click", (e) => {
DOM.$rech.value = "Ma position";
e.target.classList.add("autocompresultselected");
if (Globals.backButtonState === "searchDirections") {
setTimeout(() => {
this.hide();
Globals.menu.open("directions");
}, 250);
} else if (Globals.backButtonState === "searchIsochrone") {
setTimeout(() => {
this.hide();
Globals.menu.open("isochrone");
}, 250);
} else if (Globals.backButtonState === "searchLandmark") {
setTimeout(() => {
this.hide();
Globals.menu.open("landmark");
}, 250);
} else {
setTimeout(() =>{
this.hide();
}, 250);
}
// on realise une geolocalisation
Location.getLocation(false)
Location.getLocation(true)
.then((result) => {
DOM.$rech.value = "Ma position";
e.target.classList.add("autocompresultselected");
if (Globals.backButtonState === "searchDirections") {
setTimeout(() => {
this.hide();
Globals.menu.open("directions");
}, 250);
} else if (Globals.backButtonState === "searchIsochrone") {
setTimeout(() => {
this.hide();
Globals.menu.open("isochrone");
}, 250);
} else if (Globals.backButtonState === "searchLandmark") {
setTimeout(() => {
this.hide();
Globals.menu.open("landmark");
}, 250);
} else {
setTimeout(() =>{
this.hide();
Location.moveTo(result.coordinates, Globals.map.getZoom(), true, true);
}, 250);
}
});
}, true);

Location.moveTo(result.coordinates, Globals.map.getZoom(), true, true);
}, true);
});
document.getElementById(id.closeSearch).addEventListener("click", () => {
State.onBackKeyDown();
});
Expand Down

0 comments on commit 369fbe7

Please sign in to comment.