Permalink
Browse files

fix: fix the draw error of polyline which has empty points but still …

…fill the area. Closed #363.
  • Loading branch information...
simaQ committed Oct 9, 2018
1 parent 9e75533 commit 2c336837b59ad4140a32b80c8401f7a4e9fbbc77
Showing with 19 additions and 19 deletions.
  1. +19 −19 src/graphic/shape/polyline.js
@@ -32,27 +32,27 @@ class Polyline extends Shape {
}
}
if (!filteredPoints.length) return;
context.beginPath();
context.moveTo(filteredPoints[0].x, filteredPoints[0].y);
if (smooth) {
const constaint = [
[ 0, 0 ],
[ 1, 1 ]
];
const sps = Smooth.smooth(filteredPoints, false, constaint);
for (let i = 0, n = sps.length; i < n; i++) {
const sp = sps[i];
context.bezierCurveTo(sp[1], sp[2], sp[3], sp[4], sp[5], sp[6]);
}
} else {
let i;
let l;
for (i = 1, l = filteredPoints.length - 1; i < l; i++) {
context.lineTo(filteredPoints[i].x, filteredPoints[i].y);
if (filteredPoints.length) {
context.moveTo(filteredPoints[0].x, filteredPoints[0].y);
if (smooth) {
const constaint = [
[ 0, 0 ],
[ 1, 1 ]
];
const sps = Smooth.smooth(filteredPoints, false, constaint);
for (let i = 0, n = sps.length; i < n; i++) {
const sp = sps[i];
context.bezierCurveTo(sp[1], sp[2], sp[3], sp[4], sp[5], sp[6]);
}
} else {
let i;
let l;
for (i = 1, l = filteredPoints.length - 1; i < l; i++) {
context.lineTo(filteredPoints[i].x, filteredPoints[i].y);
}
context.lineTo(filteredPoints[l].x, filteredPoints[l].y);
}
context.lineTo(filteredPoints[l].x, filteredPoints[l].y);
}
}

0 comments on commit 2c33683

Please sign in to comment.