summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCode WvS <code-wvs@quantentunnel.de>2015-03-22 18:29:44 +0100
committerCode WvS <code-wvs@quantentunnel.de>2015-03-22 18:29:44 +0100
commite13a19b378eed8924a596878f21169be68cea251 (patch)
tree07ed20042d330eddb220b9f675d3730d4bb5ef3f
parentda0a10f4e989d83a0768602514281f0e40666e7d (diff)
downloadsnap-yow-e13a19b378eed8924a596878f21169be68cea251.tar.gz
snap-yow-e13a19b378eed8924a596878f21169be68cea251.zip
on pen up, do not draw multiple polygons from the same line
-rw-r--r--objects.js5
1 files changed, 4 insertions, 1 deletions
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