Skip to content

Commit

Permalink
fix: sort out utf lib name;
Browse files Browse the repository at this point in the history
fix problem of throwing error when pan
the move, saying problem with the nearest arrow or tile unload process;
  • Loading branch information
dadiorchen committed May 21, 2021
1 parent 45eda86 commit 779eebf
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 12 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
"@testing-library/user-event": "^7.1.2",
"expect-runtime": "^0.4.0",
"leaflet": "^1.7.1",
"leaflet-utfgrid": "git+https://github.com/dadiorchen/Leaflet.UTFGrid.git",
"leaflet.gridlayer.googlemutant": "^0.12.1",
"loglevel": "^1.7.0",
"moment": "^2.29.1",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-scripts": "3.4.1",
"source-map-explorer": "^2.5.0",
"Leaflet.UTFGrid": "git+https://github.com/dadiorchen/Leaflet.UTFGrid.git"
"source-map-explorer": "^2.5.0"
},
"scripts": {
"start": "react-scripts start",
Expand Down
2 changes: 1 addition & 1 deletion src/App.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions src/models/Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -882,8 +882,12 @@ export default class Map{
}else{
log.info("no marker");
const nearest = await this.getNearest();
const placement = this.calculatePlacement(nearest);
this.onFindNearestAt && this.onFindNearestAt(placement);
if(nearest){
const placement = this.calculatePlacement(nearest);
this.onFindNearestAt && this.onFindNearestAt(placement);
}else{
log.warn("Can't get the nearest:", nearest);
}
}
}

Expand All @@ -894,6 +898,10 @@ export default class Map{
const res = await this.requester.request({
url: `${this.apiServerUrl}nearest?zoom_level=${zoom_level}&lat=${center.lat}&lng=${center.lng}`,
});
if(!res){
log.warn("Return undefined trying to get nearest, the api return null");
return;
}
let {nearest} = res;
nearest = nearest? {
lat: nearest.coordinates[1],
Expand Down

0 comments on commit 779eebf

Please sign in to comment.