Skip to content

Commit

Permalink
Leaflet 1.0 cleanup (#153)
Browse files Browse the repository at this point in the history
* Set source argument in Popup creation

* v0.10.1

* Animate panning and zooming

* v0.10.2

* Lint 'object destructuring filter' consistently

The pattern ```const { map, url, ...props } = this.props``` usually
failed during linting, because the ```map``` variable is defined but
not used.

After adding the ```"varsIgnorePattern": "^_"``` option to the
```no-unused-vars``` rule, unused properies can be marked as:
```const { map: _, url, ...props } = this.props```.

I also updated the eslint and babel-eslint dependencies, because of
some relevant bugfixes.

* Add babel-plugin-lodash

* Introduce the concept of 'layer container', as a unified interface for L.Map and L.LayerGroup.

* v0.11 - new LayersControl

* Component-based LayersControl
* Deprecate `onLeaflet...` format for events
* React v15

* LayersControl does not pass map props to children (#142)

* v0.11.1

* v0.11.2

* Add dynamic draggable props to Marker (#148)

* expose ability to toggle marker's draggable status

* fix indentation

* v0.11.3

* Changes removeFrom to remove in MapControl

* Removes MultiPolyline; multipolylines are now supported by Polyline

* Removes MultiPolygon; multipolygons are now supported by Polygon

* Removes CanvasTileLayer, which has been removed from leaflet

* Updates Circle instantiator to use new format
  • Loading branch information
mgmeyers authored and PaulLeCam committed May 5, 2016
1 parent 4b06655 commit a8f5064
Show file tree
Hide file tree
Showing 16 changed files with 85 additions and 576 deletions.
358 changes: 67 additions & 291 deletions dist/react-leaflet.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/react-leaflet.min.js

Large diffs are not rendered by default.

53 changes: 0 additions & 53 deletions lib/CanvasTileLayer.js

This file was deleted.

5 changes: 2 additions & 3 deletions lib/Circle.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,10 @@ var Circle = function (_Path) {
var center = _props.center;
var _map = _props.map;
var _lc = _props.layerContainer;
var radius = _props.radius;

var props = _objectWithoutProperties(_props, ['center', 'map', 'layerContainer', 'radius']);
var props = _objectWithoutProperties(_props, ['center', 'map', 'layerContainer']);

this.leafletElement = (0, _leaflet.circle)(center, radius, props);
this.leafletElement = (0, _leaflet.circle)(center, props);
}
}, {
key: 'componentDidUpdate',
Expand Down
2 changes: 1 addition & 1 deletion lib/MapControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ var MapControl = function (_Component) {
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
this.leafletElement.removeFrom(this.props.map);
this.leafletElement.remove();
}
}, {
key: 'getLeafletElement',
Expand Down
71 changes: 0 additions & 71 deletions lib/MultiPolygon.js

This file was deleted.

71 changes: 0 additions & 71 deletions lib/MultiPolyline.js

This file was deleted.

4 changes: 3 additions & 1 deletion lib/Polyline.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ var _createClass = function () { function defineProperties(target, props) { for

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

var _react = require('react');

var _leaflet = require('leaflet');

var _latlngList = require('./types/latlngList');
Expand Down Expand Up @@ -64,6 +66,6 @@ var Polyline = function (_Path) {
}(_Path3.default);

Polyline.propTypes = {
positions: _latlngList2.default.isRequired
positions: _react.PropTypes.oneOfType([_latlngList2.default, _react.PropTypes.arrayOf(_latlngList2.default)]).isRequired
};
exports.default = Polyline;
17 changes: 1 addition & 16 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.setIconDefaultImagePath = exports.ZoomControl = exports.WMSTileLayer = exports.TileLayer = exports.ScaleControl = exports.Rectangle = exports.Popup = exports.Polyline = exports.Polygon = exports.Path = exports.MultiPolyline = exports.MultiPolygon = exports.Marker = exports.MapLayer = exports.MapControl = exports.MapComponent = exports.Map = exports.LayersControl = exports.LayerGroup = exports.ImageOverlay = exports.GeoJson = exports.FeatureGroup = exports.CircleMarker = exports.Circle = exports.CanvasTileLayer = exports.BaseTileLayer = exports.AttributionControl = exports.PropTypes = undefined;
exports.setIconDefaultImagePath = exports.ZoomControl = exports.WMSTileLayer = exports.TileLayer = exports.ScaleControl = exports.Rectangle = exports.Popup = exports.Polyline = exports.Polygon = exports.Path = exports.Marker = exports.MapLayer = exports.MapControl = exports.MapComponent = exports.Map = exports.LayersControl = exports.LayerGroup = exports.ImageOverlay = exports.GeoJson = exports.FeatureGroup = exports.CircleMarker = exports.Circle = exports.BaseTileLayer = exports.AttributionControl = exports.PropTypes = undefined;

var _leaflet = require('leaflet');

Expand All @@ -21,10 +21,6 @@ var _BaseTileLayer2 = require('./BaseTileLayer');

var _BaseTileLayer3 = _interopRequireDefault(_BaseTileLayer2);

var _CanvasTileLayer2 = require('./CanvasTileLayer');

var _CanvasTileLayer3 = _interopRequireDefault(_CanvasTileLayer2);

var _Circle2 = require('./Circle');

var _Circle3 = _interopRequireDefault(_Circle2);
Expand Down Expand Up @@ -73,14 +69,6 @@ var _Marker2 = require('./Marker');

var _Marker3 = _interopRequireDefault(_Marker2);

var _MultiPolygon2 = require('./MultiPolygon');

var _MultiPolygon3 = _interopRequireDefault(_MultiPolygon2);

var _MultiPolyline2 = require('./MultiPolyline');

var _MultiPolyline3 = _interopRequireDefault(_MultiPolyline2);

var _Path2 = require('./Path');

var _Path3 = _interopRequireDefault(_Path2);
Expand Down Expand Up @@ -124,7 +112,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
exports.PropTypes = _PropTypes;
exports.AttributionControl = _AttributionControl3.default;
exports.BaseTileLayer = _BaseTileLayer3.default;
exports.CanvasTileLayer = _CanvasTileLayer3.default;
exports.Circle = _Circle3.default;
exports.CircleMarker = _CircleMarker3.default;
exports.FeatureGroup = _FeatureGroup3.default;
Expand All @@ -137,8 +124,6 @@ exports.MapComponent = _MapComponent3.default;
exports.MapControl = _MapControl3.default;
exports.MapLayer = _MapLayer3.default;
exports.Marker = _Marker3.default;
exports.MultiPolygon = _MultiPolygon3.default;
exports.MultiPolyline = _MultiPolyline3.default;
exports.Path = _Path3.default;
exports.Polygon = _Polygon3.default;
exports.Polyline = _Polyline3.default;
Expand Down
11 changes: 0 additions & 11 deletions src/CanvasTileLayer.js

This file was deleted.

4 changes: 2 additions & 2 deletions src/Circle.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ export default class Circle extends Path {

componentWillMount() {
super.componentWillMount();
const { center, map: _map, layerContainer: _lc, radius, ...props } = this.props;
this.leafletElement = circle(center, radius, props);
const { center, map: _map, layerContainer: _lc, ...props } = this.props;
this.leafletElement = circle(center, props);
}

componentDidUpdate(prevProps) {
Expand Down
2 changes: 1 addition & 1 deletion src/MapControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default class MapControl extends Component {
}

componentWillUnmount() {
this.leafletElement.removeFrom(this.props.map);
this.leafletElement.remove();
}

getLeafletElement() {
Expand Down
24 changes: 0 additions & 24 deletions src/MultiPolygon.js

This file was deleted.

24 changes: 0 additions & 24 deletions src/MultiPolyline.js

This file was deleted.

6 changes: 5 additions & 1 deletion src/Polyline.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import { PropTypes } from 'react';
import { polyline } from 'leaflet';

import latlngListType from './types/latlngList';
import Path from './Path';

export default class Polyline extends Path {
static propTypes = {
positions: latlngListType.isRequired,
positions: PropTypes.oneOfType([
latlngListType,
PropTypes.arrayOf(latlngListType),
]).isRequired,
};

componentWillMount() {
Expand Down
Loading

0 comments on commit a8f5064

Please sign in to comment.