Google Maps API v3: Can I setZoom after fitBounds?

前端 未结 23 2463
执笔经年
执笔经年 2020-11-27 09:35

I have a set of points I want to plot on an embedded Google Map (API v3). I\'d like the bounds to accommodate all points unless the zoom level is too low (i.e., zoomed out

23条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-27 09:42

    I’ve just fixed this by setting maxZoom in advance, then removing it afterwards. For example:

    map.setOptions({ maxZoom: 15 });
    map.fitBounds(bounds);
    map.setOptions({ maxZoom: null });
    

提交回复
热议问题