mapbox - disabling viewing of unrendered white tiles outside of the map

المشرف العام

Administrator
طاقم الإدارة
I'm looking to disable being able to move the map in such a way that one can move outside of the map area:

I don't want to be able to see the surrounding white areas when the map is dragged. I have turned off wrapping as I don't want any horizontal duplication.

Code:

// Create a map in the div #map L.mapbox.map('map', 'example', { minZoom: 2,//need to change it to 1 maybe 0 for mobile devices // 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 } });I have a suspicion I might be able to utilise maxBounds or fitBounds but I'm no quite sure how to go about it.



أكثر...
 
أعلى