From e13a19b378eed8924a596878f21169be68cea251 Mon Sep 17 00:00:00 2001 From: Code WvS Date: Sun, 22 Mar 2015 18:29:44 +0100 Subject: on pen up, do not draw multiple polygons from the same line --- objects.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'objects.js') diff --git a/objects.js b/objects.js index f757ea4..e07789b 100644 --- a/objects.js +++ b/objects.js @@ -2937,10 +2937,13 @@ SpriteMorph.prototype.up = function (mode) { // overrides PenMorph.up this.isDown = false; this.penMode = mode[0]; // default to line + if (window.polylines[this.myPolylineIndex].getLatLngs().length < 3) + return; + if (this.penMode == 'a shape') { // transform the line that has just been finished into a polygon window.polygons[window.polygonIndex++] = L.polygon( - window.polylines[this.myPolylineIndex].getLatLngs(), + window.polylines[this.myPolylineIndex++].getLatLngs(), {color: this.color.toString(), weight: this.size}) .addTo(window.penShapes); // remove the line that is now a filled shape -- cgit v1.3.1