nakarte

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

commit ff984a79040141c35825265a68bbe8c9f7e36d9e
parent 6952e5ee5f6f00399c5fdf2712fa4df8e78593c0
Author: Sergej Orlov <wladimirych@gmail.com>
Date:   Wed,  9 Oct 2019 22:42:20 +0200

Enable display of track segments containing only one point #247

* change line style for display and print to make line ends round
  so that zero length segments becomes visible
* when loading line from file or url, duplicate point if segment contains
  only one point. This is needed because SVG lines with one point are not
  displayed.

Diffstat:
Msrc/lib/leaflet.control.track-list/track-list.js | 8++++++--
Msrc/lib/leaflet.layer.rasterize/MeasuredLine.js | 1+
2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/lib/leaflet.control.track-list/track-list.js b/src/lib/leaflet.control.track-list/track-list.js @@ -33,7 +33,7 @@ const TrackSegment = L.MeasuredLine.extend({ options: { weight: 6, - lineCap: 'butt', + lineCap: 'round', opacity: 0.5, } @@ -285,7 +285,11 @@ L.Control.TrackList = L.Control.extend({ if (!data_empty) { if (geodata.tracks) { geodata.tracks = geodata.tracks.map(function(line) { - return L.LineUtil.simplifyLatlngs(line, 360 / (1 << 24)); + line = L.LineUtil.simplifyLatlngs(line, 360 / (1 << 24)); + if (line.length == 1) { + line.push(line[0]); + } + return line; } ); } diff --git a/src/lib/leaflet.layer.rasterize/MeasuredLine.js b/src/lib/leaflet.layer.rasterize/MeasuredLine.js @@ -60,6 +60,7 @@ L.Polyline.include({ const ctx = canvas.getContext('2d'); ctx.lineWidth = this.printWidthMm / 25.4 * printOptions.resolution; ctx.lineJoin = 'round'; + ctx.lineCap = 'round'; ctx.strokeStyle = this.options.color; const transform = this._makelatLngToCanvasPixelTransformer(printOptions, shift.projected); let point;