How to replicate marker position on map loop Leaflet JS

前端 未结 1 1513
误落风尘
误落风尘 2021-01-06 01:26

I\'m using Leaflet JS to build a custom map (with custom tiles), it loops East to West. I\'ve added a couple layers of markers and polygons (to indicate a route in the map)

1条回答
  •  有刺的猬
    2021-01-06 01:59

    Use 'worldCopyJump': true in your map options.

    With this option enabled, the map tracks when you pan to another "copy" of the world and seamlessly jumps to the original one so that all overlays like markers and vector layers are still visible.

    http://leafletjs.com/reference.html#map-worldcopyjump

    Working example on Plunker: http://plnkr.co/edit/mWKc4M?p=preview

    0 讨论(0)
提交回复
热议问题