fixed the geocoder result problems
This commit is contained in:
parent
52c762fa74
commit
c677913b90
2 changed files with 5 additions and 12 deletions
|
|
@ -134,12 +134,12 @@ export default function Geocoder(props: Props) {
|
|||
geoCoder.on("error", () => {});
|
||||
|
||||
//event is fired when an option is selected from the results
|
||||
geoCoder.on("result", (res: Result) => {
|
||||
geoCoder.on("result", (res) => {
|
||||
if (resultFunction) {
|
||||
resultFunction(res);
|
||||
resultFunction(res.result);
|
||||
}
|
||||
if (customTransition) {
|
||||
customTransition(res);
|
||||
customTransition(res.result);
|
||||
}
|
||||
});
|
||||
//once the map ref and access token are set up add the control to the map
|
||||
|
|
|
|||
|
|
@ -1351,13 +1351,6 @@ import { Result } from "@mapbox/mapbox-gl-geocoder";
|
|||
};
|
||||
|
||||
const geocoderResult = (result: Result) => {
|
||||
clickDelay()
|
||||
console.log("result function")
|
||||
console.log(result)
|
||||
console.log("immediate id: " + result.id)
|
||||
setTimeout(() => {
|
||||
console.log("result.id after waiting 2 seconds: " + result.id)
|
||||
}, 2000);
|
||||
if(result.id !== undefined){
|
||||
setObjectKey(result.id.toString());
|
||||
if (result.place_type.includes("bin")) {
|
||||
|
|
@ -1375,8 +1368,8 @@ import { Result } from "@mapbox/mapbox-gl-geocoder";
|
|||
};
|
||||
|
||||
const geocoderTransition = (result: Result) => {
|
||||
let long = result.center ? result.center[0] : 0;
|
||||
let lat = result.center ? result.center[1] : 0;
|
||||
let long = result.center[0];
|
||||
let lat = result.center[1];
|
||||
if (long && lat) {
|
||||
let centered = true;
|
||||
let zoom = zoomLevels.far;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue