Skip to content

Commit

Permalink
updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Jin IGARASHI committed Jan 18, 2021
1 parent 341a1f9 commit 3539fe3
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

Adds a style switcher to `mapbox-gl`

![](https://img.shields.io/bundlephobia/min/mapbox-gl-style-switcher) <a href="https://www.npmjs.com/package/mapbox-gl-style-switcher">![](https://img.shields.io/npm/v/mapbox-gl-style-switcher)</a> ![](https://img.shields.io/npm/types/mapbox-gl-style-switcher) ![](https://img.shields.io/npm/l/mapbox-gl-style-switcher)
![](https://img.shields.io/bundlephobia/min/@watergis/mapbox-gl-style-switcher) <a href="https://www.npmjs.com/package/@watergis/mapbox-gl-style-switcher">![](https://img.shields.io/npm/v/@watergis/mapbox-gl-style-switcher)</a> ![](https://img.shields.io/npm/types/@watergis/mapbox-gl-style-switcher) ![](https://img.shields.io/npm/l/@watergis/mapbox-gl-style-switcher)


## Installation:

```bash
npm i mapbox-gl-style-switcher --save
npm i @watergis/mapbox-gl-style-switcher --save
```

## Demo:
Expand All @@ -18,10 +18,10 @@ npm i mapbox-gl-style-switcher --save
## Usage:

```ts
import { MapboxStyleSwitcherControl } from "mapbox-gl-style-switcher";
import { MapboxStyleSwitcherControl } from "@watergis/mapbox-gl-style-switcher";
import { Map as MapboxMap } from "mapbox-gl";

import "mapbox-gl-style-switcher/styles.css";
import "@watergis/mapbox-gl-style-switcher/styles.css";

const map = new MapboxMap();
map.addControl(new MapboxStyleSwitcherControl());
Expand All @@ -31,7 +31,7 @@ map.addControl(new MapboxStyleSwitcherControl());
If you want to supply your own list of styles, pass them in the constructor.

```ts
import { MapboxStyleDefinition, MapboxStyleSwitcherControl } from "mapbox-gl-style-switcher";
import { MapboxStyleDefinition, MapboxStyleSwitcherControl } from "@watergis/mapbox-gl-style-switcher";

const styles: MapboxStyleDefinition[] = [
{
Expand All @@ -58,3 +58,14 @@ map.addControl(new MapboxStyleSwitcherControl(styles, 'Dark'));
![Closed](assets/closed.png)

![Open](assets/open.png)

# Development

```
# install npm packages
npm i
# build source code
npm run build
# launch application with server
npm run dev
```

0 comments on commit 3539fe3

Please sign in to comment.