From 593a553e641b8ae87110a5a5d89b3661671a6f72 Mon Sep 17 00:00:00 2001 From: Per Liedman Date: Fri, 8 Apr 2016 16:38:21 +0200 Subject: [PATCH] Pass layer on when calling _updateDashArray Add specs to verify intialization and setStyle with dashArray. Close #4401. --- spec/suites/layer/vector/CanvasSpec.js | 14 ++++++++++++++ src/layer/vector/Canvas.js | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/spec/suites/layer/vector/CanvasSpec.js b/spec/suites/layer/vector/CanvasSpec.js index 39c45e9b..84f0f5fa 100644 --- a/spec/suites/layer/vector/CanvasSpec.js +++ b/spec/suites/layer/vector/CanvasSpec.js @@ -98,4 +98,18 @@ describe('Canvas', function () { }); + describe('#dashArray', function () { + it('can add polyline with dashArray', function () { + var layer = L.polygon(latLngs, { + dashArray: "5,5" + }).addTo(map); + }); + it('can setStyle with dashArray', function () { + var layer = L.polygon(latLngs).addTo(map); + layer.setStyle({ + dashArray: "5,5" + }); + }); + }); + }); diff --git a/src/layer/vector/Canvas.js b/src/layer/vector/Canvas.js index 453b814f..e67bbad1 100644 --- a/src/layer/vector/Canvas.js +++ b/src/layer/vector/Canvas.js @@ -103,7 +103,7 @@ L.Canvas = L.Renderer.extend({ }, _updateStyle: function (layer) { - this._updateDashArray(); + this._updateDashArray(layer); this._requestRedraw(layer); },