Update to support dashed lines.
This commit is contained in:
committed by
GitHub
parent
41f8081831
commit
99d01cd923
19
external/leaflet-src.js
vendored
19
external/leaflet-src.js
vendored
@ -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;
|
||||
@ -5144,6 +5150,13 @@ 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();
|
||||
|
Reference in New Issue
Block a user