From 3d03f9eb5cfe018fa570c95b2a58b3938665c5c6 Mon Sep 17 00:00:00 2001 From: Code WvS Date: Sat, 21 Mar 2015 16:56:48 +0100 Subject: splice, not slice lines to polygons --- objects.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'objects.js') diff --git a/objects.js b/objects.js index 57a2067..e36c205 100644 --- a/objects.js +++ b/objects.js @@ -3388,8 +3388,13 @@ SpriteMorph.prototype.drawLine = function (start, dest) { // TODO: detect and join lines with "same points" if (latlngs[j].distanceTo(destLatLng) <= 1) { var polyLL = latlngs - .slice(j, latlngs.length) + .splice(j, latlngs.length) .concat([destLatLng]); + // remove last part of line and replace by polygon + // splice deleted the latlngs that appear now in the polygon + window.polylines[this.myPolylineIndex] = L.polyline(latlngs, + {color: this.color.toString(), weight: this.size}) + .addTo(window.penLines); L.polygon(polyLL, {color: this.color.toString(), weight: this.size}) .addTo(window.penShapes); -- cgit v1.3.1