diff --git a/debug/vector/inherit-dashArray.html b/debug/vector/inherit-dashArray.html new file mode 100644 index 000000000..438ee5f5f --- /dev/null +++ b/debug/vector/inherit-dashArray.html @@ -0,0 +1,37 @@ + + + + Leaflet debug page + + + + + + + + +
+ + + + + diff --git a/debug/vector/vector-canvas.html b/debug/vector/vector-canvas.html index 7e58097c3..9323f826b 100644 --- a/debug/vector/vector-canvas.html +++ b/debug/vector/vector-canvas.html @@ -89,6 +89,14 @@ polygon.bindPopup('I am a polygon'); + var circleMarker2 = new L.CircleMarker([25.5, 0], { + dashArray: '5, 5', + fillColor: 'red', + color: 'green', + renderer: canvas + }); + group.addLayer(circleMarker2); + map.addLayer(group); diff --git a/src/layer/vector/Canvas.js b/src/layer/vector/Canvas.js index 428efd0e0..e14540fb7 100644 --- a/src/layer/vector/Canvas.js +++ b/src/layer/vector/Canvas.js @@ -271,10 +271,6 @@ export var Canvas = Renderer.extend({ ctx.beginPath(); - if (ctx.setLineDash) { - ctx.setLineDash(layer.options && layer.options._dashArray || []); - } - for (i = 0; i < len; i++) { for (j = 0, len2 = parts[i].length; j < len2; j++) { p = parts[i][j]; @@ -326,6 +322,9 @@ export var Canvas = Renderer.extend({ } if (options.stroke && options.weight !== 0) { + if (ctx.setLineDash) { + ctx.setLineDash(layer.options && layer.options._dashArray || []); + } ctx.globalAlpha = options.opacity; ctx.lineWidth = options.weight; ctx.strokeStyle = options.color;