From 5f3b22bf7f5685723e5d1a0fb18d1ec438b299aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Kr=C3=B6g?= Date: Mon, 12 Jul 2021 19:32:05 +0200 Subject: [PATCH 1/2] Remove lineCap, it is useless on closed paths --- src/ol/style/RegularShape.js | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/ol/style/RegularShape.js b/src/ol/style/RegularShape.js index 608fe057fa..87c069d669 100644 --- a/src/ol/style/RegularShape.js +++ b/src/ol/style/RegularShape.js @@ -9,7 +9,6 @@ import {asColorLike} from '../colorlike.js'; import {createCanvasContext2D} from '../dom.js'; import { defaultFillStyle, - defaultLineCap, defaultLineJoin, defaultLineWidth, defaultMiterLimit, @@ -39,7 +38,6 @@ import { * @property {import("../colorlike.js").ColorLike} [strokeStyle] StrokeStyle. * @property {number} strokeWidth StrokeWidth. * @property {number} size Size. - * @property {CanvasLineCap} lineCap LineCap. * @property {Array} lineDash LineDash. * @property {number} lineDashOffset LineDashOffset. * @property {CanvasLineJoin} lineJoin LineJoin. @@ -419,7 +417,6 @@ class RegularShape extends ImageStyle { * @protected */ createRenderOptions() { - let lineCap = defaultLineCap; let lineJoin = defaultLineJoin; let miterLimit = 0; let lineDash = null; @@ -443,10 +440,6 @@ class RegularShape extends ImageStyle { if (lineJoin === undefined) { lineJoin = defaultLineJoin; } - lineCap = this.stroke_.getLineCap(); - if (lineCap === undefined) { - lineCap = defaultLineCap; - } miterLimit = this.stroke_.getMiterLimit(); if (miterLimit === undefined) { miterLimit = defaultMiterLimit; @@ -461,7 +454,6 @@ class RegularShape extends ImageStyle { strokeStyle: strokeStyle, strokeWidth: strokeWidth, size: size, - lineCap: lineCap, lineDash: lineDash, lineDashOffset: lineDashOffset, lineJoin: lineJoin, @@ -509,7 +501,6 @@ class RegularShape extends ImageStyle { context.setLineDash(renderOptions.lineDash); context.lineDashOffset = renderOptions.lineDashOffset; } - context.lineCap = renderOptions.lineCap; context.lineJoin = renderOptions.lineJoin; context.miterLimit = renderOptions.miterLimit; context.stroke(); From 58e2e576389f4991057aef87ae1ac040d98ac8fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Kr=C3=B6g?= Date: Mon, 12 Jul 2021 01:50:04 +0200 Subject: [PATCH 2/2] Fix hit detection of RegularShape with transparent fill --- src/ol/style/RegularShape.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ol/style/RegularShape.js b/src/ol/style/RegularShape.js index 87c069d669..fbac91dc62 100644 --- a/src/ol/style/RegularShape.js +++ b/src/ol/style/RegularShape.js @@ -587,6 +587,8 @@ class RegularShape extends ImageStyle { context.setLineDash(renderOptions.lineDash); context.lineDashOffset = renderOptions.lineDashOffset; } + context.lineJoin = renderOptions.lineJoin; + context.miterLimit = renderOptions.miterLimit; context.stroke(); } }