Merge CHANGELOG into README.

This commit is contained in:
Victor Powell 2015-12-02 01:16:59 -08:00
parent a1fe3915e9
commit 56fd78cf65
2 changed files with 96 additions and 92 deletions

View File

@ -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`.

View File

@ -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.