@@ -71,13 +71,19 @@ class LeafletReactTrackPlayer extends MapLayer {
7171 } deg)${ this . props . styleMarker } "></div>`,
7272 iconSize : [ 35 , 35 ]
7373 } ) ;
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 ;
7581 const finishMarker = L . marker ( this . props . track [ 0 ] , {
7682 icon : this . createIcon ( course )
7783 } ) ;
7884 this . props . leaflet . map . addLayer ( finishMarker ) ;
7985 // polyline
80- const snakePolyline = L . multiOptionsPolyline ( this . props . track , {
86+ const snakePolyline = L . multiColorsPolyline ( this . props . track , {
8187 ...paramsForMultiPolyline ( this . props ) ,
8288 timeFormat : this . props . timeFormat ,
8389 progressFormat : this . props . progressFormat ,
@@ -130,23 +136,32 @@ class LeafletReactTrackPlayer extends MapLayer {
130136 nextPoint = ( point , index ) => {
131137 // callback: add new point to step of animation
132138 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+ ) ;
137146 } else if ( this . state . options . progressFormat === "time" ) {
138147 const thisDistance =
139148 moment ( point . t , this . props . timeFormat ) -
140149 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+ ) ;
146158 } 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+ ) ;
150165 }
151166 this . leafletElement . finishMarker . setIcon ( this . createIcon ( point . course ) ) ;
152167 } ;
@@ -188,11 +203,11 @@ class LeafletReactTrackPlayer extends MapLayer {
188203 const newPointsPolyline =
189204 this . props . progressFormat === "default" ||
190205 this . props . progressFormat === "distance"
191- ? L . multiOptionsPolyline (
206+ ? L . multiColorsPolyline (
192207 toProps . track . slice ( fromProps . track . length - 1 ) ,
193208 paramsForMultiPolyline ( this . props )
194209 )
195- : L . multiOptionsPolyline (
210+ : L . multiColorsPolyline (
196211 toProps . track . filter (
197212 item =>
198213 Number ( item . t ) >
@@ -477,21 +492,23 @@ class LeafletReactTrackPlayer extends MapLayer {
477492 className = "tp_track-line_active"
478493 />
479494 </ 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 }
495512 </ div >
496513 </ div >
497514 ) : null }
@@ -514,6 +531,7 @@ LeafletReactTrackPlayer.defaultProps = {
514531 progressFormat : "default" ,
515532 startPosition : 0 ,
516533 streamData : false ,
534+ showDots : false ,
517535 callbackFinish : function ( ) { } ,
518536 callbackPrev : function ( ) { } ,
519537 callbackNext : function ( ) { } ,
@@ -539,6 +557,7 @@ LeafletReactTrackPlayer.propTypes = {
539557 callbackFinish : PropTypes . func ,
540558 startPosition : PropTypes . oneOfType ( [ PropTypes . string , PropTypes . number ] ) ,
541559 streamData : PropTypes . bool ,
560+ showDots : PropTypes . bool ,
542561 callbackNext : PropTypes . func ,
543562 callbackPrev : PropTypes . func ,
544563 callbackSpeed : PropTypes . func ,
0 commit comments