Mapbox GL JS Cap Zoom to Avoid Duplicate Worlds

Viewed 67

I'd like to limit how much the user can zoom out, such that a region is never displayed twice on the map. I tried setting renderWorldCopies to false, but then the width of the map decreases when zooming out. How can I limit zooming out while keeping the map width at 100% of available width?

1 Answers

You can set minZoom when instantiating the map:

const map = mapboxgl.Map({ /*...*/,  minZoom: 2 })
Related