Skip to content

Commit

Permalink
Bump version to 0.3.0 (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
nagix authored Aug 24, 2021
1 parent 45ebe78 commit 177e11e
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 6 deletions.
96 changes: 92 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ See a [Live Demo](https://nagix.github.io/mapbox-gl-rain-layer).

The rain animation is up to date according to the current radar data from data sources. In addition to the density of raindrops, the colors of semi-transparent boxes indicate the intensity of rainfall.

Version 0.2 requires Mapbox GL JS 0.54.0 or later. This component works on [browsers that support ES6](https://caniuse.com/es6).
Version 0.3 requires Mapbox GL JS 0.54.0 or later. This component works on [browsers that support ES6](https://caniuse.com/es6).

## Installation

Expand All @@ -23,7 +23,7 @@ npm install mapbox-gl-rain-layer --save
To use CDN:

```html
<script src="https://cdn.jsdelivr.net/npm/mapbox-gl-rain-layer@latest"></script>
<script src="https://cdn.jsdelivr.net/npm/mapbox-gl-rain-layer@latest/dist/mapbox-gl-rain-layer.min.js"></script>
```

## Usage
Expand Down Expand Up @@ -62,7 +62,9 @@ import RainLayer from 'mapbox-gl-rain-layer';

You can find an interactive demo at [nagix.github.io/mapbox-gl-rain-layer](https://nagix.github.io/mapbox-gl-rain-layer).

## Configuration
## API

### Constructor Options

`RainLayer` supports the following constructor options.

Expand All @@ -72,10 +74,96 @@ You can find an interactive demo at [nagix.github.io/mapbox-gl-rain-layer](https
| **`options.maxzoom`** | `number` | | The maximum zoom level for the layer. At zoom levels equal to or greater than the maxzoom, the layer will be hidden. The value can be any number between `0` and `24` (inclusive). If no maxzoom is provided, the layer will be visible at all zoom levels for which there are tiles available.
| **`options.meshOpacity`** | `number` | `0.1` | The opacity of mesh boxes. The value can be any number between `0` and `1` (inclusive).
| **`options.minzoom`** | `number` | | The minimum zoom level for the layer. At zoom levels less than the minzoom, the layer will be hidden. The value can be any number between `0` and `24` (inclusive). If no minzoom is provided, the layer will be visible at all zoom levels for which there are tiles available.
| **`options.rainColor`** | `string` | `'#fff'` | The color of raindrops. This color can be specified as `rgba` with an alpha component. The default is white.
| **`options.rainColor`** | `string` | `'#fff'` | The color of raindrops. Colors are strings in a variety of permitted formats: HTML-style hex values, RGB, RGBA, HSL and HSLA. Predefined HTML colors names, like `yellow` and `blue`, are also permitted. The default is white.
| **`options.scale`** | `string` | `'noaa'` | The type of the color scale for the radar/precipitation data. Currently, only `'noaa'` is supported. See [Radar Images: Reflectivity](https://www.weather.gov/jetstream/refl) by National Weather Service for details.
| **`options.source`** | `string` | `'rainviewer'` | The data source for the layer. Currently, only `'rainviewer'` is supported.

### Instance Members

#### **`getLegendHTML()`**

Returns the HTML text for the legend.

##### Returns

`string`: The HTML text for the legend.

#### **`off(type, listener)`**

Removes an event listener previously added with `RainLayer#on`.

##### Parameters

**`type`** (string) The event type previously used to install the listener.

**`listener`** (function) The function previously installed as a listener.

##### Returns

`RainLayer`: `this`

#### **`on(type, listener)`**

Adds a listener for events of a specified type.

##### Parameters

**`type`** (`string`) The event type to listen for.

**`listener`** (`function`) The function to be called when the event is fired.

##### Returns

`RainLayer`: `this`

#### **`once(type, listener)`**

Adds a listener that will be called only once to a specified event type.

##### Parameters

**`type`** (`string`) The event type to add a listener for.

**`listener`** (`function`) The function to be called when the event is fired.

##### Returns

`RainLayer`: `this`

#### **`setMeshOpacity(opacity)`**

Sets the opacity of mesh boxes.

##### Parameters

**`opacity`** (`number`) The opacity of mesh boxes. The value can be any number between `0` and `1` (inclusive).

##### Returns

`RainLayer`: `this`

#### **`setRainColor(color)`**

Sets the color of raindrops.

##### Parameters

**`color`** (`string`) The color of raindrops. Colors are strings in a variety of permitted formats: HTML-style hex values, RGB, RGBA, HSL and HSLA. Predefined HTML colors names, like `yellow` and `blue`, are also permitted.

##### Returns

`RainLayer`: `this`

### Events

#### **`refresh`**

Fired when the radar data is refreshed.

##### Properties

**`timestamp`** (`number`): Unix timestamp in seconds (UTC) when the data was generated

## Building

You first need to install node dependencies (requires [Node.js](https://nodejs.org/)):
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mapbox-gl-rain-layer",
"version": "0.2.0",
"version": "0.3.0",
"description": "Mapbox GL Rain Layer",
"main": "dist/mapbox-gl-rain-layer.js",
"module": "dist/mapbox-gl-rain-layer.esm.js",
Expand All @@ -17,7 +17,7 @@
"eslint-plugin-import": "^2.24.1",
"eslint-plugin-jsdoc": "^36.0.7",
"mapbox-gl": "^2.4.1",
"rollup": "^2.56.2",
"rollup": "^2.56.3",
"rollup-plugin-terser": "^7.0.2"
},
"peerDependencies": {
Expand Down

0 comments on commit 177e11e

Please sign in to comment.