Skip to content

Commit

Permalink
feat: can click and show tree panel
Browse files Browse the repository at this point in the history
  • Loading branch information
dadiorchen committed Apr 9, 2021
1 parent a22c6b1 commit 89b09c4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
27 changes: 10 additions & 17 deletions src/App.js

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

15 changes: 11 additions & 4 deletions src/models/Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ export default class Map{
const [southWestLng, southWestLat, northEastLng, northEastLat] =
this.bounds.split(",");
log.warn("fly to bounds:", this.bounds);
this.map.flyToBounds([
// this.map.flyToBounds([
this.map.fitBounds([
[southWestLat, southWestLng],
[northEastLat, northEastLng]
]);
Expand Down Expand Up @@ -152,8 +153,8 @@ export default class Map{
minZoom: this.minZoom,
maxZoom: this.maxZoom,
//close to avoid too many requests
updateWhenZooming: false,
updateWhenIdle: false,
updateWhenZooming: true,
updateWhenIdle: true,
}
);
this.layerTile.addTo(this.map);
Expand All @@ -171,7 +172,12 @@ export default class Map{
this.layerUtfGrid.on('click', (e) => {
log.warn("click:", e);
if (e.data) {
this.clickMarker(e.data);
const [lon, lat] = JSON.parse(e.data.latlon).coordinates;
this.clickMarker({
...e.data,
lat,
lon,
});
}
});

Expand Down Expand Up @@ -261,6 +267,7 @@ export default class Map{
this.unHighlightMarker();
const [lon, lat] = JSON.parse(data.latlon).coordinates;
if(data.type === "point"){
this.onClickTree && this.onClickTree(data);
}else if(data.type === "cluster"){
if(data.zoom_to){
log.info("found zoom to:", data.zoom_to);
Expand Down

0 comments on commit 89b09c4

Please sign in to comment.