File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
laeflet-react-track-player Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,8 @@ class App extends Component {
1010 lng : 40.272891666666666 ,
1111 zoom : 14 ,
1212 type : "time" ,
13- demo : demo
13+ demo : demo ,
14+ icon : "/img/mech.svg"
1415 } ;
1516 render ( ) {
1617 const position = [ demo [ demo . length - 1 ] . lat , demo [ demo . length - 1 ] . lng ] ;
@@ -34,7 +35,7 @@ class App extends Component {
3435 customMarker = { true }
3536 streamData = { true }
3637 changeCourseCustomMarker = { true }
37- iconCustomMarker = { "/img/mech.svg" }
38+ iconCustomMarker = { this . state . icon }
3839 />
3940 < TileLayer
4041 attribution = "&copy <a href="http://osm.org/copyright">OpenStreetMap</a> contributors"
Original file line number Diff line number Diff line change @@ -238,6 +238,9 @@ class LeafletReactTrackPlayer extends MapLayer {
238238 this . updateProgressByTime ( toProps , distanceNewPoints ) ;
239239 }
240240 }
241+ if ( fromProps . iconCustomMarker !== toProps . iconCustomMarker ) {
242+ this . leafletElement . finishMarker . _icon . children [ 0 ] . style . background = `url(${ toProps . iconCustomMarker } ) center center no-repeat` ;
243+ }
241244 }
242245
243246 updateProgressByDefault = ( from , to , newDistance ) => {
You can’t perform that action at this time.
0 commit comments