mirror of
https://github.com/visgl/react-map-gl.git
synced 2025-12-08 20:16:02 +00:00
Merge CHANGELOG into README.
This commit is contained in:
parent
a1fe3915e9
commit
56fd78cf65
92
CHANGELOG.md
92
CHANGELOG.md
@ -1,92 +0,0 @@
|
||||
## 0.6
|
||||
|
||||
### Breaking changes
|
||||
|
||||
#### No longer provide viewport props transparently to overlay children.
|
||||
|
||||
Require viewport props to be explicitly provided to overlays. Previously,
|
||||
viewport overlay props all had to be optional because the elements were created
|
||||
once and then cloned inside of `<MapGL>`. This also made it difficult to follow
|
||||
what props were being passed automatically to overlays. In addition, it meant
|
||||
that overlays could only be direct children of the `<MapGL>` element.
|
||||
|
||||
This shouldn't require changes to overlays, other than marking viewport props
|
||||
as required. It will only involve passing the needed props explicitly to
|
||||
overlays.
|
||||
|
||||
Old way:
|
||||
|
||||
```js
|
||||
<MapGL {...viewport}>
|
||||
<Overlay1 />
|
||||
<Overlay2 />
|
||||
</MapGL>
|
||||
```
|
||||
|
||||
New way:
|
||||
|
||||
```js
|
||||
<MapGL {...viewport}>
|
||||
<Overlay1 {...viewport}/>
|
||||
<Overlay2 {...viewport}/>
|
||||
</MapGL>
|
||||
```
|
||||
|
||||
For any third party overlay's that depend on `project` or `unproject` props,
|
||||
either update them to calculate the `project`/`unproject` functions from the
|
||||
viewport using the [ViewportMercatorProject](github.com/uber-common/viewport-mercator-project) module or provide them explicitly in the same render function as the
|
||||
`<MapGL/>` component. example:
|
||||
|
||||
```js
|
||||
var ViewportMercator = require('viewport-mercator-project');
|
||||
// ...
|
||||
render() {
|
||||
var mercator = ViewportMercator(this.state.viewport);
|
||||
return <MapGL ...viewport>
|
||||
<Overlay1
|
||||
project={mercator.project}
|
||||
unproject={this.mercator.unproject
|
||||
{...viewport}/>
|
||||
{/* or equivalently */}
|
||||
<Overlay2 {...mercator} {...viewport}/>
|
||||
</MapGL>;
|
||||
}
|
||||
</MapGL>
|
||||
```
|
||||
|
||||
#### Swapping LatLng for LngLat
|
||||
|
||||
This is more inline with
|
||||
[MapboxGL-js](https://github.com/mapbox/mapbox-gl-js/pull/1433) and GeoJSON.
|
||||
|
||||
Accessors that were previously `latLngAccessor` are have been renamed to
|
||||
`lngLatAccessor`.
|
||||
|
||||
Rename the viewport prop `startDragLatLng` to `startDragLngLat`.
|
||||
|
||||
The `project` function prop passed to overlays now expecteds an array of
|
||||
the form `[logitude, latitude]` instead of `[latitude, longitude]`.
|
||||
|
||||
The `project` function prop now returns an array of `[pixelX, pixelY]` instead
|
||||
of an object of the form `{x:pixelX, y: pixelY}`.
|
||||
|
||||
The `unproject` function prop passed to overlays now returns an array of
|
||||
the form `[longitude, latitude]` instead of a MapboxGL
|
||||
[LngLat](https://www.mapbox.com/mapbox-gl-js/api/#LngLat) object.
|
||||
|
||||
DraggablePointsOverlay's `locationAccessor` prop was renamed `lngLatAccessor`
|
||||
to be more consistent with other overlays.
|
||||
|
||||
#### `bbox` property of the `onChangeViewport` event was removed
|
||||
|
||||
This should be calculated instead using the [ViewportMercatorProject](github.com/uber-common/viewport-mercator-project) module instead.
|
||||
|
||||
```js
|
||||
var mercator = ViewportMercator(viewport);
|
||||
var bbox = [mercator.unproject([0, 0]), mercator.unproject([width, height])];
|
||||
```
|
||||
|
||||
### Non-breaking changes
|
||||
|
||||
`unproject` was added to the arguments passed to the `redraw` callback in the
|
||||
`CanvasOverlay`.
|
||||
96
README.md
96
README.md
@ -113,6 +113,102 @@ Once complete, you can view the component in your browser at
|
||||
[localhost:9966](http://localhost:9966). Any changes you make will automatically
|
||||
run the compiler to build the files again.
|
||||
|
||||
# CHANGE LOG
|
||||
|
||||
### 0.6
|
||||
|
||||
### Breaking changes
|
||||
|
||||
#### No longer provide viewport props transparently to overlay children.
|
||||
|
||||
Require viewport props to be explicitly provided to overlays. Previously,
|
||||
viewport overlay props all had to be optional because the elements were created
|
||||
once and then cloned inside of `<MapGL>`. This also made it difficult to follow
|
||||
what props were being passed automatically to overlays. In addition, it meant
|
||||
that overlays could only be direct children of the `<MapGL>` element.
|
||||
|
||||
This shouldn't require changes to overlays, other than marking viewport props
|
||||
as required. It will only involve passing the needed props explicitly to
|
||||
overlays.
|
||||
|
||||
Old way:
|
||||
|
||||
```js
|
||||
<MapGL {...viewport}>
|
||||
<Overlay1 />
|
||||
<Overlay2 />
|
||||
</MapGL>
|
||||
```
|
||||
|
||||
New way:
|
||||
|
||||
```js
|
||||
<MapGL {...viewport}>
|
||||
<Overlay1 {...viewport}/>
|
||||
<Overlay2 {...viewport}/>
|
||||
</MapGL>
|
||||
```
|
||||
|
||||
For any third party overlay's that depend on `project` or `unproject` props,
|
||||
either update them to calculate the `project`/`unproject` functions from the
|
||||
viewport using the [ViewportMercatorProject](github.com/uber-common/viewport-mercator-project) module or provide them explicitly in the same render function as the
|
||||
`<MapGL/>` component. example:
|
||||
|
||||
```js
|
||||
var ViewportMercator = require('viewport-mercator-project');
|
||||
// ...
|
||||
render() {
|
||||
var mercator = ViewportMercator(this.state.viewport);
|
||||
return <MapGL ...viewport>
|
||||
<Overlay1
|
||||
project={mercator.project}
|
||||
unproject={this.mercator.unproject
|
||||
{...viewport}/>
|
||||
{/* or equivalently */}
|
||||
<Overlay2 {...mercator} {...viewport}/>
|
||||
</MapGL>;
|
||||
}
|
||||
</MapGL>
|
||||
```
|
||||
|
||||
#### Swapping LatLng for LngLat
|
||||
|
||||
This is more inline with
|
||||
[MapboxGL-js](https://github.com/mapbox/mapbox-gl-js/pull/1433) and GeoJSON.
|
||||
|
||||
Accessors that were previously `latLngAccessor` are have been renamed to
|
||||
`lngLatAccessor`.
|
||||
|
||||
Rename the viewport prop `startDragLatLng` to `startDragLngLat`.
|
||||
|
||||
The `project` function prop passed to overlays now expecteds an array of
|
||||
the form `[logitude, latitude]` instead of `[latitude, longitude]`.
|
||||
|
||||
The `project` function prop now returns an array of `[pixelX, pixelY]` instead
|
||||
of an object of the form `{x:pixelX, y: pixelY}`.
|
||||
|
||||
The `unproject` function prop passed to overlays now returns an array of
|
||||
the form `[longitude, latitude]` instead of a MapboxGL
|
||||
[LngLat](https://www.mapbox.com/mapbox-gl-js/api/#LngLat) object.
|
||||
|
||||
DraggablePointsOverlay's `locationAccessor` prop was renamed `lngLatAccessor`
|
||||
to be more consistent with other overlays.
|
||||
|
||||
#### `bbox` property of the `onChangeViewport` event was removed
|
||||
|
||||
This should be calculated instead using the [ViewportMercatorProject](github.com/uber-common/viewport-mercator-project) module instead.
|
||||
|
||||
```js
|
||||
var mercator = ViewportMercator(viewport);
|
||||
var bbox = [mercator.unproject([0, 0]), mercator.unproject([width, height])];
|
||||
```
|
||||
|
||||
### Non-breaking changes
|
||||
|
||||
`unproject` was added to the arguments passed to the `redraw` callback in the
|
||||
`CanvasOverlay`.
|
||||
|
||||
|
||||
## Disclaimer
|
||||
|
||||
This project is not affiliated with either Facebook or Mapbox.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user