最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Mapbox change zoom on click event - Stack Overflow

programmeradmin1浏览0评论

I have a map where the starting zoom level is 5. When a user clicks on a point, I want the map to go to that point and and change the zoom to level 10. I'm using the flyTo() method to center the map on the point. How can I change the zoom level?

I have a map where the starting zoom level is 5. When a user clicks on a point, I want the map to go to that point and and change the zoom to level 10. I'm using the flyTo() method to center the map on the point. How can I change the zoom level?

Share Improve this question asked May 22, 2018 at 19:45 leelum1leelum1 1,25411 silver badges20 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 10

I realised I can add zoom to flyTo() like:

map.flyTo({center: e.features[0].geometry.coordinates, zoom:10});

I'll take my downvote

发布评论

评论列表(0)

  1. 暂无评论