getImage is always called with valid pixelRatio

This commit is contained in:
Maximilian Krög
2021-07-04 14:32:36 +02:00
parent 5716c614a8
commit 28c40fe93e

View File

@@ -225,19 +225,19 @@ class RegularShape extends ImageStyle {
* @api
*/
getImage(pixelRatio) {
if (!this.canvas_[pixelRatio || 1]) {
let image = this.canvas_[pixelRatio];
if (!image) {
const renderOptions = this.createRenderOptions();
const context = createCanvasContext2D(
renderOptions.size * pixelRatio || 1,
renderOptions.size * pixelRatio || 1
renderOptions.size * pixelRatio,
renderOptions.size * pixelRatio
);
this.draw_(renderOptions, context, pixelRatio);
this.draw_(renderOptions, context, pixelRatio || 1);
this.canvas_[pixelRatio || 1] = context.canvas;
image = context.canvas;
this.canvas_[pixelRatio] = image;
}
return this.canvas_[pixelRatio || 1];
return image;
}
/**