[Leaflet] Update to support dashed lines and circles
This commit is contained in:
parent
2bdc063ab7
commit
0f86bfae6a
27
external/leaflet-src.js
vendored
27
external/leaflet-src.js
vendored
@ -5103,6 +5103,12 @@ L.Path = (L.Path.SVG && !window.L_PREFER_CANVAS) || !L.Browser.canvas ? L.Path :
|
|||||||
_updateStyle: function () {
|
_updateStyle: function () {
|
||||||
var options = this.options;
|
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) {
|
if (options.stroke) {
|
||||||
this._ctx.lineWidth = options.weight;
|
this._ctx.lineWidth = options.weight;
|
||||||
this._ctx.strokeStyle = options.color;
|
this._ctx.strokeStyle = options.color;
|
||||||
@ -5121,7 +5127,14 @@ L.Path = (L.Path.SVG && !window.L_PREFER_CANVAS) || !L.Browser.canvas ? L.Path :
|
|||||||
|
|
||||||
_drawPath: function () {
|
_drawPath: function () {
|
||||||
var i, j, len, len2, point, drawMethod;
|
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();
|
this._ctx.beginPath();
|
||||||
|
|
||||||
for (i = 0, len = this._parts.length; i < len; i++) {
|
for (i = 0, len = this._parts.length; i < len; i++) {
|
||||||
@ -5148,6 +5161,12 @@ L.Path = (L.Path.SVG && !window.L_PREFER_CANVAS) || !L.Browser.canvas ? L.Path :
|
|||||||
var ctx = this._ctx,
|
var ctx = this._ctx,
|
||||||
options = this.options;
|
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();
|
this._drawPath();
|
||||||
ctx.save();
|
ctx.save();
|
||||||
this._updateStyle();
|
this._updateStyle();
|
||||||
@ -6075,6 +6094,12 @@ L.Polygon.include(!L.Path.CANVAS ? {} : {
|
|||||||
|
|
||||||
L.Circle.include(!L.Path.CANVAS ? {} : {
|
L.Circle.include(!L.Path.CANVAS ? {} : {
|
||||||
_drawPath: function () {
|
_drawPath: function () {
|
||||||
|
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([]);
|
||||||
|
}
|
||||||
var p = this._point;
|
var p = this._point;
|
||||||
this._ctx.beginPath();
|
this._ctx.beginPath();
|
||||||
this._ctx.arc(p.x, p.y, this._radius, 0, Math.PI * 2, false);
|
this._ctx.arc(p.x, p.y, this._radius, 0, Math.PI * 2, false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user