Update to support dashed lines.

This commit is contained in:
Stephen Kraushaar
2016-06-24 05:52:18 -05:00
committed by GitHub
parent 41f8081831
commit 99d01cd923

View File

@ -5132,6 +5132,12 @@ L.Path = (L.Path.SVG && !window.L_PREFER_CANVAS) || !L.Browser.canvas ? L.Path :
_updateStyle: function () {
var options = this.options;
if (options.dashArray) {
var da = typeof(options.dashArray) === "string" ? options.dashArray.split(",").map(function(el,ix,ar) { return parseInt(el); }) : options.dashArray;
this._ctx.setLineDash(da);
} else {
this._ctx.setLineDash([]);
}
if (options.stroke) {
this._ctx.lineWidth = options.weight;
this._ctx.strokeStyle = options.color;
@ -5143,7 +5149,14 @@ L.Path = (L.Path.SVG && !window.L_PREFER_CANVAS) || !L.Browser.canvas ? L.Path :
_drawPath: function () {
var i, j, len, len2, point, drawMethod;
if (this.options.dashArray) {
var da = typeof(this.options.dashArray) === "string" ? this.options.dashArray.split(",").map(function(el,ix,ar) { return parseInt(el); }) : this.options.dashArray;
this._ctx.setLineDash(da);
} else {
this._ctx.setLineDash([]);
}
this._ctx.beginPath();
for (i = 0, len = this._parts.length; i < len; i++) {
@ -5170,6 +5183,12 @@ L.Path = (L.Path.SVG && !window.L_PREFER_CANVAS) || !L.Browser.canvas ? L.Path :
var ctx = this._ctx,
options = this.options;
if (options.dashArray) {
var da = typeof(options.dashArray) === "string" ? options.dashArray.split(",").map(function(el,ix,ar) { return parseInt(el); }) : options.dashArray;
ctx.setLineDash(da);
} else {
ctx.setLineDash([]);
}
this._drawPath();
ctx.save();
this._updateStyle();