No unnecessary canvas with transparent fill

With pixelRatio != 1 and a transparent fill a unnecessary image was created.
This commit is contained in:
Maximilian Krög
2021-07-11 03:16:02 +02:00
parent 7e33c41697
commit 82265ef031

View File

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