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 {
10
10
lng : 40.272891666666666 ,
11
11
zoom : 14 ,
12
12
type : "time" ,
13
- demo : demo
13
+ demo : demo ,
14
+ icon : "/img/mech.svg"
14
15
} ;
15
16
render ( ) {
16
17
const position = [ demo [ demo . length - 1 ] . lat , demo [ demo . length - 1 ] . lng ] ;
@@ -34,7 +35,7 @@ class App extends Component {
34
35
customMarker = { true }
35
36
streamData = { true }
36
37
changeCourseCustomMarker = { true }
37
- iconCustomMarker = { "/img/mech.svg" }
38
+ iconCustomMarker = { this . state . icon }
38
39
/>
39
40
< TileLayer
40
41
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 {
238
238
this . updateProgressByTime ( toProps , distanceNewPoints ) ;
239
239
}
240
240
}
241
+ if ( fromProps . iconCustomMarker !== toProps . iconCustomMarker ) {
242
+ this . leafletElement . finishMarker . _icon . children [ 0 ] . style . background = `url(${ toProps . iconCustomMarker } ) center center no-repeat` ;
243
+ }
241
244
}
242
245
243
246
updateProgressByDefault = ( from , to , newDistance ) => {
You can’t perform that action at this time.
0 commit comments