MAPG-107 use bigger resolution if the device pixel ratio is big
This commit is contained in:
parent
6acb19ba36
commit
8b9dd0bc32
@ -70,12 +70,30 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var Util = {
|
||||||
|
getHighResData: function () {
|
||||||
|
if (window.devicePixelRatio >= 4) {
|
||||||
|
return { ppi: 320, tileSize: 128, zoomOffset: 1 };
|
||||||
|
} else if (window.devicePixelRatio >= 2) {
|
||||||
|
return { ppi: 250, tileSize: 256, zoomOffset: 0 };
|
||||||
|
} else {
|
||||||
|
return { ppi: 72, tileSize: 512, zoomOffset: -1 };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
MapEditor.map = L.map('map', {
|
MapEditor.map = L.map('map', {
|
||||||
attributionControl: false,
|
attributionControl: false,
|
||||||
zoomControl: false
|
zoomControl: false
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var highResData = Util.getHighResData();
|
||||||
|
|
||||||
L.tileLayer(tileUrl, {
|
L.tileLayer(tileUrl, {
|
||||||
|
subdomains: '1234',
|
||||||
|
ppi: highResData.ppi,
|
||||||
|
tileSize: highResData.tileSize,
|
||||||
|
zoomOffset: highResData.zoomOffset,
|
||||||
minZoom: 0,
|
minZoom: 0,
|
||||||
maxZoom: 20
|
maxZoom: 20
|
||||||
}).addTo(MapEditor.map);
|
}).addTo(MapEditor.map);
|
||||||
|
Loading…
Reference in New Issue
Block a user