Skip to content
This repository has been archived by the owner on Jul 6, 2023. It is now read-only.

Commit

Permalink
feat(shouldCancelZooms): Adds boolean to data sources to allow to can…
Browse files Browse the repository at this point in the history
…cel zooms in them
  • Loading branch information
ibesora committed Jul 15, 2022
1 parent 28367fb commit fbd05a8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/frontends/leaflet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export type DataSourceOptions = {
headers?: { [key: string]: string };
maxDataZoom?: number;
levelDiff?: number;
shouldCancelZooms?: boolean;
};
export type DataSource = {
name: string;
Expand Down
21 changes: 18 additions & 3 deletions src/view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,11 +274,26 @@ export const sourceToView = (o: any) => {
const maxDataZoom = o.maxDataZoom === undefined ? 14 : o.maxDataZoom;
let source;
if (o.url.url) {
source = new PmtilesSource(o.url, true, o.headers, o.subdomains);
source = new PmtilesSource(
o.url,
o.shouldCancelZooms ?? true,
o.headers,
o.subdomains
);
} else if (o.url.endsWith(".pmtiles")) {
source = new PmtilesSource(o.url, true, o.headers, o.subdomains);
source = new PmtilesSource(
o.url,
o.shouldCancelZooms ?? true,
o.headers,
o.subdomains
);
} else {
source = new ZxySource(o.url, true, o.headers, o.subdomains);
source = new ZxySource(
o.url,
o.shouldCancelZooms ?? true,
o.headers,
o.subdomains
);
}
const cache = new TileCache(source, (256 * 1) << level_diff);
return new View(cache, maxDataZoom, level_diff);
Expand Down

0 comments on commit fbd05a8

Please sign in to comment.