make sure we actually stroke out the section when we break out of the loop
authorRobert Kaiser <kairo@kairo.at>
Mon, 10 Feb 2020 20:27:43 +0000 (21:27 +0100)
committerRobert Kaiser <kairo@kairo.at>
Mon, 10 Feb 2020 20:27:43 +0000 (21:27 +0100)
js/map.js
manifest.appcache

index 4cae845edabdf162942a6321b3ff570bd23db065..9f95971c37823d6102f5ad275eff40843e31add3 100644 (file)
--- a/js/map.js
+++ b/js/map.js
@@ -675,6 +675,7 @@ var gTrackLayer = {
         gTrackLayer.drawTrackPoint(gTrackLayer.lastRequestedIndex);
         if (performance.now() >= start + gTrackLayer.maxDrawTime) {
           // Break out of the loop if we are over the max allowed time, we'll continue in the next rAF (see below).
+          gTrackLayer.drawTrackPoint(null);
           break;
         }
       }
@@ -688,6 +689,14 @@ var gTrackLayer = {
 
   drawTrackPoint: function(aIndex) {
     gTrackLayer.running = true;
+    if (!aIndex && aIndex !== 0) {
+      // We can be called this way to make sure we draw an actual line up to where we are right now.
+      if (gTrackLayer.lastDrawnPoint && gTrackLayer.lastDrawnPoint.optimized) {
+        gTrackLayer.context.stroke();
+        gTrackLayer.lastDrawnPoint.optimized = false;
+      }
+      return;
+    }
     var trackpoint = {"worldpos": gps2xy(gTrack[aIndex].coords.latitude, gTrack[aIndex].coords.longitude)};
     var isLastPoint = (aIndex + 1 >= gTrack.length || gTrack[aIndex+1].beginSegment);
     var update_drawnpoint = true;
index e4fd815de1314473683555191f5383533d3bd8ec..d2a928dc14bf90ca64e0260224ec9a16ead21538 100644 (file)
@@ -1,6 +1,6 @@
 CACHE MANIFEST
 
-# 2018-01-22
+# 2020-02-10
 index.html
 login.html
 manifest.webapp