nakarte

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

commit b1e5686a0ca5b72fee457706a3117f8c86133299
parent 380959f7f03b74a331fa731373da78d0cb16bb9e
Author: Sergej Orlov <wladimirych@gmail.com>
Date:   Wed, 18 Sep 2019 21:14:41 +0200

measured line: skipping drawing lines with less then 2 points

Diffstat:
Msrc/lib/leaflet.layer.rasterize/MeasuredLine.js | 5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/lib/leaflet.layer.rasterize/MeasuredLine.js b/src/lib/leaflet.layer.rasterize/MeasuredLine.js @@ -46,11 +46,14 @@ L.Polyline.include({ const latlngs = this.getLatLngs(); const shift = this._shift(printOptions.latLngBounds, printOptions.zoom); const lineBounds = this.getBounds(); + if (latlngs.length < 2) { + return; + } const shiftedLineBounds = L.latLngBounds([ [lineBounds.getNorth(), lineBounds.getWest() + shift.lng], [lineBounds.getSouth(), lineBounds.getEast() + shift.lng] ]); - if (!latlngs.length || !shiftedLineBounds.intersects(printOptions.latLngBounds)) { + if (!shiftedLineBounds.intersects(printOptions.latLngBounds)) { return; }