getImage is always called with valid pixelRatio
This commit is contained in:
@@ -225,19 +225,19 @@ class RegularShape extends ImageStyle {
|
|||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
getImage(pixelRatio) {
|
getImage(pixelRatio) {
|
||||||
if (!this.canvas_[pixelRatio || 1]) {
|
let image = this.canvas_[pixelRatio];
|
||||||
|
if (!image) {
|
||||||
const renderOptions = this.createRenderOptions();
|
const renderOptions = this.createRenderOptions();
|
||||||
|
|
||||||
const context = createCanvasContext2D(
|
const context = createCanvasContext2D(
|
||||||
renderOptions.size * pixelRatio || 1,
|
renderOptions.size * pixelRatio,
|
||||||
renderOptions.size * pixelRatio || 1
|
renderOptions.size * pixelRatio
|
||||||
);
|
);
|
||||||
|
this.draw_(renderOptions, context, pixelRatio);
|
||||||
|
|
||||||
this.draw_(renderOptions, context, pixelRatio || 1);
|
image = context.canvas;
|
||||||
|
this.canvas_[pixelRatio] = image;
|
||||||
this.canvas_[pixelRatio || 1] = context.canvas;
|
|
||||||
}
|
}
|
||||||
return this.canvas_[pixelRatio || 1];
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user