revert setting maxzoom in leaflet adapter in favor of explicit async header loading.

This commit is contained in:
Brandon Liu
2022-10-17 21:14:17 +08:00
parent 819a0e6f2b
commit 5eb5dd7580

View File

@@ -4,23 +4,6 @@ import { PMTiles, Source } from "./index";
export const leafletRasterLayer = (source: PMTiles, options: any) => { export const leafletRasterLayer = (source: PMTiles, options: any) => {
const cls = L.GridLayer.extend({ const cls = L.GridLayer.extend({
createTile: function (coord: any, done: any) { createTile: function (coord: any, done: any) {
if (!this.pmtilesHeaderLoaded) {
source.getHeader().then((h) => {
// Unfortunately this needs to call into private leaflet properties
// and might break in future versions
// because layer creation is synchronous and these are specified at
// initialization time
// TODO: set bounds?
if (this.options.maxNativeZoom == undefined) {
this.options.minNativeZoom = h.minZoom;
}
if (this.options.maxNativeZoom == undefined) {
this.options.maxNativeZoom = h.maxZoom;
}
});
this.pmtilesHeaderLoaded = true;
}
const el: any = document.createElement("img"); const el: any = document.createElement("img");
const controller = new AbortController(); const controller = new AbortController();
const signal = controller.signal; const signal = controller.signal;