首页 文章

Mapbox:在找到的位置设置缩放级别

提问于
浏览
0

传单文档告诉我,您应该在位置使用maxZoom选项,但它不起作用(http://leafletjs.com/reference.html#map-locate-options) . 当用户在我的网站上使用地理位置并在 Map 上找到他们的位置时,它会放大太多而我想自己规范 . 有人有快速解决方法吗?

1 回答

  • 0

    在你的main.js中,你必须在本节中设置locate选项

    if (!navigator.geolocation) {
            geolocate.innerHTML = 'Geolocation is not available';
        } else {
            geolocate.onclick = function (e) {
                var tl = new TimelineMax({repeat:2});   
                tl.to("svg.pointwhite", .10, {transformOrigin: "50% 100%", scaleY:0.25, yoyo:true, repeat:1})
                  .to("svg.pointwhite", .65, {y:-6, ease:Circ.easeOut, yoyo:true, repeat:1});                   
                e.preventDefault();
                e.stopPropagation();
                map.locate({ maxZoom: 12}); // locate option goes here       
            };
        }
    

相关问题