Skip to content

Commit

Permalink
fix: typedeclaration for basemaps
Browse files Browse the repository at this point in the history
  • Loading branch information
kaditya97 committed Sep 6, 2023
1 parent afa3603 commit 9d8514b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ or
```html
<link href="https://unpkg.com/maplibre-gl@2.2.0/dist/maplibre-gl.css" rel="stylesheet" />
<script src="https://unpkg.com/maplibre-gl@2.2.0/dist/maplibre-gl.js"></script>
<script src="https://unpkg.com/maplibre-basemaps@0.0.3/dist/maplibre-basemaps.js"></script>
<script src="https://unpkg.com/maplibre-basemaps@0.0.4/dist/maplibre-basemaps.js"></script>
```

## Usage
Expand Down
4 changes: 2 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<title>Maplibre Basemaps</title>
<script src="https://unpkg.com/maplibre-gl@2.2.0/dist/maplibre-gl.js"></script>
<link href="https://unpkg.com/maplibre-gl@2.2.0/dist/maplibre-gl.css" rel="stylesheet" />
<script src="../dist/maplibre-basemaps.js"></script>
<!-- <script src="https://unpkg.com/maplibre-basemaps@0.0.3/dist/maplibre-basemaps.js"></script> -->
<!-- <script src="../dist/maplibre-basemaps.js"></script> -->
<script src="https://unpkg.com/maplibre-basemaps@0.0.4/dist/maplibre-basemaps.js"></script>
<style>
body {
margin: 0;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "maplibre-basemaps",
"version": "0.0.3",
"version": "0.0.4",
"description": "Maplibre plugin to add basemaps layer switcher",
"keywords": [
"maplibre",
Expand Down
12 changes: 7 additions & 5 deletions src/maplibre-basemaps.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
import { LayerSpecification, SourceSpecification, Map } from 'maplibre-gl';

type Visibility = 'visible' | 'none';

export interface BaseLayerConfig {
name: string;
tiles: Array<string>;
visibility: 'visible' | 'none';
visibility: Visibility;
attribution?: string;
minZoom?: number;
maxZoom?: number;
}

export interface BasemapsConfig {
basemaps: BaseLayerConfig;
basemaps: { [key: string]: BaseLayerConfig };
width?: string;
height?: string;
}

export class BasemapControl {
basemaps: BaseLayerConfig;
basemaps: { [key: string]: BaseLayerConfig };
config: BasemapsConfig;
_container: HTMLElement;
constructor(config: BasemapsConfig) {
Expand Down Expand Up @@ -146,8 +148,8 @@ export class BasemapControl {
type: 'raster',
tiles: value.tiles,
tileSize: 256,
minzoom: value.minzoom ?? 0,
maxzoom: value.maxzoom ?? 18,
minzoom: value.minZoom ?? 0,
maxzoom: value.maxZoom ?? 18,
attribution: value.attribution ?? '',
}

Expand Down

0 comments on commit 9d8514b

Please sign in to comment.