Skip to content

Commit 60dc4cf

Browse files
committed
update icon
1 parent 7d9a256 commit 60dc4cf

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/App.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff 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="&amp;copy <a href=&quot;http://osm.org/copyright&quot;>OpenStreetMap</a> contributors"

src/laeflet-react-track-player/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff 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) => {

0 commit comments

Comments
 (0)