From 3c5cf0fd2b99ddd84a1d4477009e4f69876bf99f Mon Sep 17 00:00:00 2001 From: Vladimir Agafonkin Date: Thu, 12 Dec 2013 16:23:12 -0500 Subject: [PATCH] fix stroke appearing on polygon clip edges --- src/layer/vector2/Polygon.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/layer/vector2/Polygon.js b/src/layer/vector2/Polygon.js index e4c4d22a..86b126d7 100644 --- a/src/layer/vector2/Polygon.js +++ b/src/layer/vector2/Polygon.js @@ -39,7 +39,12 @@ L.Polygon = L.Polyline.extend({ _clipPoints: function () { var points = this._originalPoints, bounds = this._renderer._bounds, - parts = points[0] instanceof L.Point ? [points] : points; + parts = points[0] instanceof L.Point ? [points] : points, + w = this.options.weight, + p = new L.Point(w, w); + + // increase clip padding by stroke width to avoid stroke on clip edges + bounds = new L.Bounds(bounds.min.subtract(p), bounds.max.add(p)); this._parts = [];