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); + } } /**