From 9292a1b76e7ff35b9c384c1f4f63bad881db166e Mon Sep 17 00:00:00 2001 From: Robert Kaiser Date: Mon, 10 Feb 2020 21:27:43 +0100 Subject: [PATCH] make sure we actually stroke out the section when we break out of the loop --- js/map.js | 9 +++++++++ manifest.appcache | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/js/map.js b/js/map.js index 4cae845..9f95971 100644 --- 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; diff --git a/manifest.appcache b/manifest.appcache index e4fd815..d2a928d 100644 --- a/manifest.appcache +++ b/manifest.appcache @@ -1,6 +1,6 @@ CACHE MANIFEST -# 2018-01-22 +# 2020-02-10 index.html login.html manifest.webapp -- 2.43.0