adds geolocation to map
This commit is contained in:
@@ -461,7 +461,7 @@
|
|||||||
) {
|
) {
|
||||||
if (showElevationMarker) {
|
if (showElevationMarker) {
|
||||||
elevationMarker.setOpacity("1");
|
elevationMarker.setOpacity("1");
|
||||||
}
|
}
|
||||||
map?.setPaintProperty(id, "line-width", 7);
|
map?.setPaintProperty(id, "line-width", 7);
|
||||||
hoveringTrail = true;
|
hoveringTrail = true;
|
||||||
// map?.setPaintProperty(id, "line-color", "#2766e3");
|
// map?.setPaintProperty(id, "line-color", "#2766e3");
|
||||||
@@ -567,7 +567,7 @@
|
|||||||
|
|
||||||
const startEndPoint = findStartAndEndPoints(geojson);
|
const startEndPoint = findStartAndEndPoints(geojson);
|
||||||
|
|
||||||
if(!startEndPoint.length) {
|
if (!startEndPoint.length) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -735,6 +735,22 @@
|
|||||||
"top-left",
|
"top-left",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
map.addControl(
|
||||||
|
new M.GeolocateControl({
|
||||||
|
positionOptions: {
|
||||||
|
enableHighAccuracy: true,
|
||||||
|
},
|
||||||
|
fitBoundsOptions: {
|
||||||
|
animate: fitBounds == "animate"
|
||||||
|
},
|
||||||
|
trackUserLocation: true,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (showStyleSwitcher) {
|
||||||
|
map.addControl(switcherControl);
|
||||||
|
}
|
||||||
|
|
||||||
if (showElevation) {
|
if (showElevation) {
|
||||||
epc = new ElevationProfileControl({
|
epc = new ElevationProfileControl({
|
||||||
visible: false,
|
visible: false,
|
||||||
@@ -755,7 +771,7 @@
|
|||||||
onLeave: () => {
|
onLeave: () => {
|
||||||
elevationMarker.setOpacity("0");
|
elevationMarker.setOpacity("0");
|
||||||
},
|
},
|
||||||
onMove: (data) => {
|
onMove: (data) => {
|
||||||
if (!hoveringTrail) {
|
if (!hoveringTrail) {
|
||||||
elevationMarker.setLngLat(
|
elevationMarker.setLngLat(
|
||||||
data.position as M.LngLatLike,
|
data.position as M.LngLatLike,
|
||||||
@@ -765,9 +781,6 @@
|
|||||||
});
|
});
|
||||||
map.addControl(epc);
|
map.addControl(epc);
|
||||||
}
|
}
|
||||||
if (showStyleSwitcher) {
|
|
||||||
map.addControl(switcherControl);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (showFullscreen) {
|
if (showFullscreen) {
|
||||||
map.addControl(
|
map.addControl(
|
||||||
|
|||||||
Reference in New Issue
Block a user