@@ -80,6 +80,7 @@ var LeafletReactTrackPlayer = function (_MapLayer) {
80
80
81
81
_this . initSnake = function ( ) {
82
82
_this . leafletElement . snakePolyline . snakePlayer ( {
83
+ play : _this . state . active ,
83
84
fly : function fly ( point ) {
84
85
return _this . flyTrack ( point ) ;
85
86
} ,
@@ -98,6 +99,9 @@ var LeafletReactTrackPlayer = function (_MapLayer) {
98
99
} ) ;
99
100
}
100
101
} ) ;
102
+ if ( ! _this . state . active ) {
103
+ _this . leafletElement . snakePolyline . snakeStop ( ) ;
104
+ }
101
105
_this . setState ( { init : true } ) ;
102
106
} ;
103
107
@@ -291,7 +295,7 @@ var LeafletReactTrackPlayer = function (_MapLayer) {
291
295
_this . state = {
292
296
activePosition : props . startPosition === 0 ,
293
297
track : props . track ,
294
- active : true ,
298
+ active : props . autoplay ,
295
299
activeStream : props . streamData ,
296
300
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 ,
297
301
speed : props . speedArray [ 0 ] ,
@@ -318,7 +322,7 @@ var LeafletReactTrackPlayer = function (_MapLayer) {
318
322
iconSize : [ 35 , 35 ]
319
323
} ) ;
320
324
} ;
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 ;
322
326
var finishMarker = _leaflet2 . default . marker ( this . props . track [ 0 ] , {
323
327
icon : this . createIcon ( course )
324
328
} ) ;
@@ -330,6 +334,7 @@ var LeafletReactTrackPlayer = function (_MapLayer) {
330
334
startPosition : this . props . startPosition ,
331
335
defaultSpeed : this . props . defaultSpeed
332
336
} ) ) ;
337
+
333
338
this . props . leaflet . map . addLayer ( snakePolyline ) ;
334
339
return {
335
340
snakePolyline : snakePolyline ,
@@ -513,6 +518,7 @@ var LeafletReactTrackPlayer = function (_MapLayer) {
513
518
} ( _reactLeaflet . MapLayer ) ;
514
519
515
520
LeafletReactTrackPlayer . defaultProps = {
521
+ autoplay : true ,
516
522
useControl : true ,
517
523
useInformationPanel : false ,
518
524
optionMultyIdxFn : function optionMultyIdxFn ( ) { } ,
@@ -537,6 +543,7 @@ LeafletReactTrackPlayer.defaultProps = {
537
543
} ;
538
544
539
545
LeafletReactTrackPlayer . propTypes = {
546
+ autoplay : _propTypes2 . default . bool ,
540
547
track : _propTypes2 . default . arrayOf ( _propTypes2 . default . object ) ,
541
548
useControl : _propTypes2 . default . bool ,
542
549
useInformationPanel : _propTypes2 . default . oneOfType ( [ _propTypes2 . default . bool , _propTypes2 . default . func ] ) ,
0 commit comments