From 002e0de26da04b15d65673310ffc10e080313cac Mon Sep 17 00:00:00 2001 From: jiaming <743192023@qq.com> Date: Sun, 9 Dec 2018 19:48:46 +0800 Subject: [PATCH] fix polyline bug --- src/plugins/canvasExtend.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/plugins/canvasExtend.js b/src/plugins/canvasExtend.js index 94c1034..2fbc345 100644 --- a/src/plugins/canvasExtend.js +++ b/src/plugins/canvasExtend.js @@ -15,17 +15,15 @@ export function drawLine (ctx, lineBegin, lineEnd, lineWidth = 2, lineColor = '# ctx.stroke() } -export function drawPolyline (ctx, points, lineWidth = 2, lineColor = '#000', close = false, dashArray = [10, 10]) { +export function drawPolyline (ctx, points, lineWidth = 2, lineColor = '#000', close = false, dashArray = [10, 0]) { if (!ctx || !points.length) return ctx.beginPath() - points.forEach((point, i) => i === 0 ? ctx.moveTo(...point) : ctx.LineTo(...point)) + points.forEach((point, i) => i === 0 ? ctx.moveTo(...point) : ctx.lineTo(...point)) close && ctx.lineTo(...points[0]) - ctx.closePath() - ctx.lineWidth = lineWidth ctx.strokeStyle = lineColor ctx.setLineDash(dashArray)