adjust zoom levels as well (otherwise markers seem mispositioned)

This commit is contained in:
Mithgol the Webmaster 2012-03-30 09:46:31 +04:00
parent 443181af07
commit cc0fc0e5b7

View File

@ -28,9 +28,15 @@ L.TileLayer = L.Class.extend({
initialize: function (url, options) {
L.Util.setOptions(this, options);
// detecting retina displays, adjusting tileSize
if (this.options.detectRetina && window.devicePixelRatio > 1) {
// detecting retina displays, adjusting tileSize and zoom levels
if (this.options.detectRetina
&& window.devicePixelRatio > 1
&& options.maxZoom > 0
){
this.options.tileSize >>= 1;
options.zoomOffset++;
if (options.minZoom > 0) options.minZoom--;
options.maxZoom--;
}
this._url = url;