summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCode WvS <code-wvs@quantentunnel.de>2015-03-21 16:56:48 +0100
committerCode WvS <code-wvs@quantentunnel.de>2015-03-21 16:56:48 +0100
commit3d03f9eb5cfe018fa570c95b2a58b3938665c5c6 (patch)
tree0d41328ba385806d878a4e4e8460f4412393a397
parent312ec24097d8a2e6adfdd55e24b3472e9d514be5 (diff)
downloadsnap-yow-3d03f9eb5cfe018fa570c95b2a58b3938665c5c6.tar.gz
snap-yow-3d03f9eb5cfe018fa570c95b2a58b3938665c5c6.zip
splice, not slice lines to polygons
-rw-r--r--objects.js7
1 files changed, 6 insertions, 1 deletions
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);