nakarte

Source code of https://map.sikmir.ru (fork)
git clone git://git.sikmir.ru/nakarte
Log | Files | Refs | LICENSE

commit e255798f693b56295aa7d999d0fb973c6afec912
parent fd3a80acbecf92a47443aa9ddf62c2e770cae740
Author: Sergey Orlov <wladimirych@gmail.com>
Date:   Sat, 11 Apr 2020 14:20:11 +0200

measured lines: change first/last marker placement logic

Original logic:
* do not create any markers for very short tracks
New logic:
* add only ending marker for very short tracks
* skip the marker before the ending one if they are close to each other.

Fixes: #361

Diffstat:
Msrc/lib/leaflet.polyline-measure/index.js | 7++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/lib/leaflet.polyline-measure/index.js b/src/lib/leaflet.polyline-measure/index.js @@ -153,10 +153,15 @@ L.MeasuredLine = L.Polyline.extend({ } lastPointMeasure = nextPointMeasure; } + // remove last mark if it is close to track end + if (lastPointMeasure - lastTickMeasure < minTicksIntervalMeters / 2) { + ticks.pop(); + } + // special case: if track is versy short, do not add starting mark if (lastPointMeasure > minTicksIntervalMeters / 2) { addTick(points[0], [points[0], points[1]], 0); - addTick(points[points_n - 1], [points[points_n - 2], points[points_n - 1]], lastPointMeasure); } + addTick(points[points_n - 1], [points[points_n - 2], points[points_n - 1]], lastPointMeasure); return ticks; },