changeset 119:08caf18bd9ef

livemap: Fix marker display issue
author Lewin Bormann <lbo@spheniscida.de>
date Fri, 01 Jan 2021 01:22:48 +0100
parents ffc3ec017bad
children 5c68b135deef 3798cd438c3c
files assets/livemap.html
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/assets/livemap.html	Thu Dec 31 19:59:19 2020 +0100
+++ b/assets/livemap.html	Fri Jan 01 01:22:48 2021 +0100
@@ -55,6 +55,7 @@
         let accuracy = props.accuracy;
         var oldCoord = current_marker.getLatLng();
         current_marker.setLatLng(L.latLng(lat, lng));
+        console.log(current_marker);
         // Show accuracy of current location
         const currentCircleProps = {
             color: 'aqua',
@@ -82,7 +83,6 @@
             radius: accuracy ? accuracy : 3,
         };
         var circle = L.circle([lat, lng], circleProps).addTo(mymap);
-        console.log(props);
         circle.bindTooltip(locationTooltip(props));
         allMarkers.push(circle);
     }
@@ -94,6 +94,7 @@
         }
         current_marker.remove();
         current_circle.remove();
+        current_marker = L.marker([0,0]).addTo(mymap);
     }
 
     // New points are available. Display them on the map and update the marker.
@@ -119,14 +120,13 @@
                 if (features.length > 0) {
                     for (i = 1; i < features.length; i++) {
                         var coords = features[i]['geometry']['coordinates'];
-                        console.log('features:', i, features[i].properties);
                         addMarker(coords[1], coords[0], features[i].properties);
                     }
                 }
 
                 var coords = lastfeature['geometry']['coordinates'];
 
-                //console.log('Received update:', coords, 'last:', response);
+                console.log('Received update:', coords, 'last:', response);
                 setCurrentLocation(coords[1], coords[0], lastfeature.properties);
                 // 13 is a good default zoom for an updated point.
                 mymap.setView([coords[1], coords[0]], mapZoomed ? mymap.getZoom() : 13);