diff --git a/mapper/src/App.js b/mapper/src/App.js
index b2d18f7..b129cd8 100644
--- a/mapper/src/App.js
+++ b/mapper/src/App.js
@@ -130,7 +130,7 @@ function MapViewManager({ coords, mapState, setMapState, loading, setSubmenu })
return null;
}
-function PolylineWithArrows({ coords }) {
+function PolylineWithArrows({ coords, showDirection }) {
const map = useMap();
const polylineRef = useRef(null);
const decoratorRef = useRef(null);
@@ -148,25 +148,29 @@ function PolylineWithArrows({ coords }) {
polylineRef.current = polyline;
map.addLayer(polyline);
- const decorator = leaflet.polylineDecorator(polyline, {
- patterns: [
- {
- offset: 25,
- repeat: 100,
- symbol: leaflet.Symbol.arrowHead({
- pixelSize: 15,
- polygon: false,
- pathOptions: {
- stroke: true,
- color: 'blue',
- weight: 3
- }
- })
- }
- ]
- });
- decoratorRef.current = decorator;
- map.addLayer(decorator);
+ if (showDirection) {
+ const decorator = leaflet.polylineDecorator(polyline, {
+ patterns: [
+ {
+ offset: 25,
+ repeat: 100,
+ symbol: leaflet.Symbol.arrowHead({
+ pixelSize: 15,
+ polygon: false,
+ pathOptions: {
+ stroke: true,
+ color: 'blue',
+ weight: 3
+ }
+ })
+ }
+ ]
+ });
+ decoratorRef.current = decorator;
+ map.addLayer(decorator);
+ } else {
+ decoratorRef.current = null;
+ }
}
return () => {
@@ -177,12 +181,12 @@ function PolylineWithArrows({ coords }) {
map.removeLayer(decoratorRef.current);
}
};
- }, [coords, map]);
+ }, [coords, map, showDirection]);
return null;
}
-function Map({end, duration, slider, mapState, setMapState, setSubmenu}) {
+function Map({end, duration, slider, mapState, setMapState, setSubmenu, showDirection}) {
const [data, loading] = useSensor('owntracks', 'OwnTracks', end, duration);
const range = useMemo(() => parseSlider(end, duration, slider), [end, duration, slider]);
@@ -242,7 +246,7 @@ function Map({end, duration, slider, mapState, setMapState, setSubmenu}) {
attribution='© OpenStreetMap contributors'
url='https://maptiles.p.rapidapi.com/en/map/v1/{z}/{x}/{y}.png?rapidapi-key=4375b0b1d8msh0c9e7fa3efb9adfp1769dfjsnd603a0387fea'
/>
-