Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions src/elements/element.line.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,24 @@ module.exports = Element.extend({
var globalDefaults = defaults.global;
var globalOptionLineElements = globalDefaults.elements.line;
var lastDrawnIndex = -1;
var closePath = me._loop;
var index, current, previous, currentVM;

// If we are looping, adding the first point again
if (me._loop && points.length) {
points.push(points[0]);
if (!spanGaps) {
for (index = points.length - 1; index >= 0; --index) {
// If the line has an open path, shift the point array
if (points[index]._view.skip) {
points = points.slice(index).concat(points.slice(0, index));
closePath = false;
break;
}
}
}
// If the line has a close path, add the first point again
if (closePath) {
points.push(points[0]);
}
}

ctx.save();
Expand Down Expand Up @@ -90,6 +103,10 @@ module.exports = Element.extend({
}
}

if (closePath) {
ctx.closePath();
}

ctx.stroke();
ctx.restore();
}
Expand Down
Loading