From 82265ef0317066ad84b12b35bf8484677eb87196 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Kr=C3=B6g?= Date: Sun, 11 Jul 2021 03:16:02 +0200 Subject: [PATCH] No unnecessary canvas with transparent fill With pixelRatio != 1 and a transparent fill a unnecessary image was created. --- src/ol/style/RegularShape.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ol/style/RegularShape.js b/src/ol/style/RegularShape.js index 0d5452228d..a5de79c5d8 100644 --- a/src/ol/style/RegularShape.js +++ b/src/ol/style/RegularShape.js @@ -494,7 +494,6 @@ class RegularShape extends ImageStyle { * @param {RenderOptions} renderOptions Render options. */ createHitDetectionCanvas_(renderOptions) { - this.hitDetectionCanvas_ = this.getImage(1); if (this.fill_) { let color = this.fill_.getColor(); @@ -520,6 +519,9 @@ class RegularShape extends ImageStyle { this.drawHitDetectionCanvas_(renderOptions, context, 0, 0); } } + if (!this.hitDetectionCanvas_) { + this.hitDetectionCanvas_ = this.getImage(1); + } } /**