From 665a956bc2ac633ff31388860d91545285adcf22 Mon Sep 17 00:00:00 2001 From: palewire Date: Fri, 12 Jul 2013 22:37:30 -0700 Subject: [PATCH] New stroke-linecap style option with a VML alternative. For #1643. --- src/layer/vector/Path.SVG.js | 3 +++ src/layer/vector/Path.VML.js | 3 +++ src/layer/vector/Path.js | 1 + 3 files changed, 7 insertions(+) diff --git a/src/layer/vector/Path.SVG.js b/src/layer/vector/Path.SVG.js index 723b8edd..9e08557d 100644 --- a/src/layer/vector/Path.SVG.js +++ b/src/layer/vector/Path.SVG.js @@ -80,6 +80,9 @@ L.Path = L.Path.extend({ } else { this._path.removeAttribute('stroke-dasharray'); } + if (this.options.linecap) { + this._path.setAttribute('stroke-linecap', this.options.linecap); + } } else { this._path.setAttribute('stroke', 'none'); } diff --git a/src/layer/vector/Path.VML.js b/src/layer/vector/Path.VML.js index 265b7972..cf98a72d 100644 --- a/src/layer/vector/Path.VML.js +++ b/src/layer/vector/Path.VML.js @@ -82,6 +82,9 @@ L.Path = L.Browser.svg || !L.Browser.vml ? L.Path : L.Path.extend({ } else { stroke.dashStyle = ''; } + if (options.linecap) { + stroke.endcap = options.linecap.replace('butt', 'flat'); + } } else if (stroke) { container.removeChild(stroke); diff --git a/src/layer/vector/Path.js b/src/layer/vector/Path.js index ca242fe9..14a14849 100644 --- a/src/layer/vector/Path.js +++ b/src/layer/vector/Path.js @@ -18,6 +18,7 @@ L.Path = L.Class.extend({ stroke: true, color: '#0033ff', dashArray: null, + linecap: null, weight: 5, opacity: 0.5,