@@ -71,13 +71,19 @@ class LeafletReactTrackPlayer extends MapLayer {
71
71
} deg)${ this . props . styleMarker } "></div>`,
72
72
iconSize : [ 35 , 35 ]
73
73
} ) ;
74
- const course = this . props . customMarker && this . props . customCourse && this . state . track [ 0 ] && this . state . track [ 0 ] . course ? this . state . track [ 0 ] . course : null ;
74
+ const course =
75
+ this . props . customMarker &&
76
+ this . props . customCourse &&
77
+ this . state . track [ 0 ] &&
78
+ this . state . track [ 0 ] . course
79
+ ? this . state . track [ 0 ] . course
80
+ : null ;
75
81
const finishMarker = L . marker ( this . props . track [ 0 ] , {
76
82
icon : this . createIcon ( course )
77
83
} ) ;
78
84
this . props . leaflet . map . addLayer ( finishMarker ) ;
79
85
// polyline
80
- const snakePolyline = L . multiOptionsPolyline ( this . props . track , {
86
+ const snakePolyline = L . multiColorsPolyline ( this . props . track , {
81
87
...paramsForMultiPolyline ( this . props ) ,
82
88
timeFormat : this . props . timeFormat ,
83
89
progressFormat : this . props . progressFormat ,
@@ -130,23 +136,32 @@ class LeafletReactTrackPlayer extends MapLayer {
130
136
nextPoint = ( point , index ) => {
131
137
// callback: add new point to step of animation
132
138
if ( this . state . options . progressFormat === "default" ) {
133
- this . setState ( {
134
- activePoint : point ,
135
- activePosition : ( index / this . state . track . length ) * 100
136
- } , ( ) => this . props . callbackCourse ( point , index ) ) ;
139
+ this . setState (
140
+ {
141
+ activePoint : point ,
142
+ activePosition : ( index / this . state . track . length ) * 100
143
+ } ,
144
+ ( ) => this . props . callbackCourse ( point , index )
145
+ ) ;
137
146
} else if ( this . state . options . progressFormat === "time" ) {
138
147
const thisDistance =
139
148
moment ( point . t , this . props . timeFormat ) -
140
149
moment ( this . state . track [ 0 ] . t , this . props . timeFormat ) ;
141
- this . setState ( {
142
- activePoint : point ,
143
- activeTimeStamp : point . t ,
144
- activePosition : thisDistance / ( this . state . durationTrack / 100 )
145
- } , ( ) => this . props . callbackCourse ( point , index ) ) ;
150
+ this . setState (
151
+ {
152
+ activePoint : point ,
153
+ activeTimeStamp : point . t ,
154
+ activePosition : thisDistance / ( this . state . durationTrack / 100 )
155
+ } ,
156
+ ( ) => this . props . callbackCourse ( point , index )
157
+ ) ;
146
158
} else if ( this . state . options . progressFormat === "distance" ) {
147
- this . setState ( {
148
- activePoint : point
149
- } , ( ) => this . props . callbackCourse ( point , index ) ) ;
159
+ this . setState (
160
+ {
161
+ activePoint : point
162
+ } ,
163
+ ( ) => this . props . callbackCourse ( point , index )
164
+ ) ;
150
165
}
151
166
this . leafletElement . finishMarker . setIcon ( this . createIcon ( point . course ) ) ;
152
167
} ;
@@ -188,11 +203,11 @@ class LeafletReactTrackPlayer extends MapLayer {
188
203
const newPointsPolyline =
189
204
this . props . progressFormat === "default" ||
190
205
this . props . progressFormat === "distance"
191
- ? L . multiOptionsPolyline (
206
+ ? L . multiColorsPolyline (
192
207
toProps . track . slice ( fromProps . track . length - 1 ) ,
193
208
paramsForMultiPolyline ( this . props )
194
209
)
195
- : L . multiOptionsPolyline (
210
+ : L . multiColorsPolyline (
196
211
toProps . track . filter (
197
212
item =>
198
213
Number ( item . t ) >
@@ -477,21 +492,23 @@ class LeafletReactTrackPlayer extends MapLayer {
477
492
className = "tp_track-line_active"
478
493
/>
479
494
</ div >
480
- < div
481
- className = "tp_track-points"
482
- ref = { e => {
483
- this . pointsLine = e ;
484
- } }
485
- >
486
- < Dots
487
- key = { "markers" }
488
- track = { this . state . track }
489
- type = { this . state . options . progressFormat }
490
- timeFormat = { this . props . timeFormat }
491
- maxDistance = { this . state . maxDistance }
492
- durationTrack = { this . state . durationTrack }
493
- />
494
- </ div >
495
+ { this . props . showDots ? (
496
+ < div
497
+ className = "tp_track-points"
498
+ ref = { e => {
499
+ this . pointsLine = e ;
500
+ } }
501
+ >
502
+ < Dots
503
+ key = { "markers" }
504
+ track = { this . state . track }
505
+ type = { this . state . options . progressFormat }
506
+ timeFormat = { this . props . timeFormat }
507
+ maxDistance = { this . state . maxDistance }
508
+ durationTrack = { this . state . durationTrack }
509
+ />
510
+ </ div >
511
+ ) : null }
495
512
</ div >
496
513
</ div >
497
514
) : null }
@@ -514,6 +531,7 @@ LeafletReactTrackPlayer.defaultProps = {
514
531
progressFormat : "default" ,
515
532
startPosition : 0 ,
516
533
streamData : false ,
534
+ showDots : false ,
517
535
callbackFinish : function ( ) { } ,
518
536
callbackPrev : function ( ) { } ,
519
537
callbackNext : function ( ) { } ,
@@ -539,6 +557,7 @@ LeafletReactTrackPlayer.propTypes = {
539
557
callbackFinish : PropTypes . func ,
540
558
startPosition : PropTypes . oneOfType ( [ PropTypes . string , PropTypes . number ] ) ,
541
559
streamData : PropTypes . bool ,
560
+ showDots : PropTypes . bool ,
542
561
callbackNext : PropTypes . func ,
543
562
callbackPrev : PropTypes . func ,
544
563
callbackSpeed : PropTypes . func ,
0 commit comments