Skip to content

Commit b60f7e8

Browse files
committed
added babel-cli to devDependencies and generate main file in lib
1 parent 47da079 commit b60f7e8

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

lib/index.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ var LeafletReactTrackPlayer = function (_MapLayer) {
8080

8181
_this.initSnake = function () {
8282
_this.leafletElement.snakePolyline.snakePlayer({
83+
play: _this.state.active,
8384
fly: function fly(point) {
8485
return _this.flyTrack(point);
8586
},
@@ -98,6 +99,9 @@ var LeafletReactTrackPlayer = function (_MapLayer) {
9899
});
99100
}
100101
});
102+
if (!_this.state.active) {
103+
_this.leafletElement.snakePolyline.snakeStop();
104+
}
101105
_this.setState({ init: true });
102106
};
103107

@@ -291,7 +295,7 @@ var LeafletReactTrackPlayer = function (_MapLayer) {
291295
_this.state = {
292296
activePosition: props.startPosition === 0,
293297
track: props.track,
294-
active: true,
298+
active: props.autoplay,
295299
activeStream: props.streamData,
296300
durationTrack: props.progressFormat === "time" ? (0, _moment2.default)(props.track[_this.props.track.length - 1].t, props.timeFormat) - (0, _moment2.default)(props.track[0].t, props.timeFormat) : 0,
297301
speed: props.speedArray[0],
@@ -318,7 +322,7 @@ var LeafletReactTrackPlayer = function (_MapLayer) {
318322
iconSize: [35, 35]
319323
});
320324
};
321-
var course = this.props.customMarker && this.props.customCourse && this.props.track[0] && this.props.track[0].course ? this.props.track[0].course : null;
325+
var course = this.props.customMarker && this.props.customCourse && this.props.track[0] && this.props.track[0].course !== undefined ? this.props.track[0].course : null;
322326
var finishMarker = _leaflet2.default.marker(this.props.track[0], {
323327
icon: this.createIcon(course)
324328
});
@@ -330,6 +334,7 @@ var LeafletReactTrackPlayer = function (_MapLayer) {
330334
startPosition: this.props.startPosition,
331335
defaultSpeed: this.props.defaultSpeed
332336
}));
337+
333338
this.props.leaflet.map.addLayer(snakePolyline);
334339
return {
335340
snakePolyline: snakePolyline,
@@ -513,6 +518,7 @@ var LeafletReactTrackPlayer = function (_MapLayer) {
513518
}(_reactLeaflet.MapLayer);
514519

515520
LeafletReactTrackPlayer.defaultProps = {
521+
autoplay: true,
516522
useControl: true,
517523
useInformationPanel: false,
518524
optionMultyIdxFn: function optionMultyIdxFn() {},
@@ -537,6 +543,7 @@ LeafletReactTrackPlayer.defaultProps = {
537543
};
538544

539545
LeafletReactTrackPlayer.propTypes = {
546+
autoplay: _propTypes2.default.bool,
540547
track: _propTypes2.default.arrayOf(_propTypes2.default.object),
541548
useControl: _propTypes2.default.bool,
542549
useInformationPanel: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.func]),

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
},
8282
"devDependencies": {
8383
"autoprefixer": "7.1.6",
84+
"babel-cli": "^6.26.0",
8485
"babel-core": "6.26.0",
8586
"babel-eslint": "7.2.3",
8687
"babel-jest": "20.0.3",

0 commit comments

Comments
 (0)