Skip to content

Commit

Permalink
Merge pull request #103 from Mohmn/appropiate-zoom-level
Browse files Browse the repository at this point in the history
feat: setted  zoom level to 5 if the cluster count is 1
  • Loading branch information
dadiorchen authored Jul 20, 2022
2 parents 67e6485 + 0395346 commit 4eb711a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export default class Map {
debug: false,
moreEffect: true,
filters: {},
defaultZoomLevelForTreePoint: 15,
},
...options,
}
Expand Down Expand Up @@ -679,7 +680,14 @@ export default class Map {

clickMarker(data) {
this.unHighlightMarker()
if (data.type === 'point') {
if (
data.type === 'point' ||
(data.type === 'cluster' && data.count === 1)
) {
if (data.type === 'cluster') {
const { lon, lat } = data
this.map.flyTo([lat, lon], this.defaultZoomLevelForTreePoint)
}
this.selectMarker(data)
if (this.onClickTree) {
this.onClickTree(data)
Expand Down

0 comments on commit 4eb711a

Please sign in to comment.