mapbox / mapbox.js

Mapbox JavaScript API, a Leaflet Plugin
mapbox.com/mapbox.js/
Other
1.92k stars 386 forks source link

maxNativeZoom on TileLayer #1250

Open tvblomberg opened 6 years ago

tvblomberg commented 6 years ago

Hello,

I am currently in the process of upgrading from version 2.1.5 to 3.1.1. I ran into an issue with the maxNativeZoom option on tile layer.

Basically it looks like it is being ignored and the map keeps zooming displaying white tiles. My expectation is the tiles should be autoscaled.

This worked find in version 2.1.5. Here are the fiddles: 2.1.5: https://jsfiddle.net/jfwkq0s4/4/ 3.1.1: http://jsfiddle.net/dbpfcoqo/6/

Simple code example: ` L.mapbox.accessToken = 'pk.eyJ1IjoidHZibG9tYmVyZyIsImEiOiJjaXZsZmpsMWwwNXBuMnRudmJqNGQyMjJwIn0.842ovgKydac51tg6b9qKbg'; var map = L.mapbox.map('map', null, { maxZoom: 20}) .setView([40, -74.50], 9);

var layer = new L.mapbox.tileLayer('mapbox.streets', { maxNativeZoom: 17, maxZoom: 20 });

map.addLayer(layer); `

tvblomberg commented 6 years ago

See my solution here: https://stackoverflow.com/questions/48195486/is-there-an-issue-with-maxnativezoom-on-tile-layers-in-mapboxjs/48209306#48209306

Not sure if this is the best approach curious on anyone's thoughts.

tvblomberg commented 6 years ago

I will make a pull request for this tonight when I have time.