[英]Disable horizontal repeating of world map with mapbox
我对 JS 很陌生,所以也许我的问题很容易解决,尽管我已经花了很多时间。
我将 Mapbox 与传单 api 一起使用,我想在缩小时禁用水平世界地图的重复。 我已经探索了 maxBounds 属性,但它并不令人满意,因为我想将地图隐藏在边界之外。 基本上,我想要这个结果http://jsfiddle.net/zF6bf/但不是“画布”,我想要这张地图,存储在 mapbox.com 上:cartogrph.hbem5mod
此外,我想禁用拖动和缩放处理程序,因此我正在寻找与以下内容兼容的解决方案:
// disable drag and zoom handlers
map.dragging.disable();
map.touchZoom.disable();
map.doubleClickZoom.disable();
map.scrollWheelZoom.disable();
// disable tap handler, if present.
if (map.tap) map.tap.disable();
谁能帮我? 我会很高兴的。
提前致谢,乔纳斯
请参阅文档: 禁用 World Wrapping
<script>
var map = L.mapbox.map('map','cartogrph.hbem5mod', {
// these options apply to the tile layer in the map
tileLayer: {
// this map option disables world wrapping. by default, it is false.
continuousWorld: false,
// this option disables loading tiles outside of the world bounds.
noWrap: true
}
}).setView([38, -102.0], 5);
</script>
我发现现有的答案对我不起作用。 但是您可以使用RenderWorldCopies
属性来执行此操作。 查看文档
您可以使用构造函数的选项
new mapboxgl.Map({
renderWorldCopies: false,
// your other options....
})
或者使用以下方法:
map.setRenderWorldCopies(true);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.