Fix first opening of fonts combobox

This commit is contained in:
Julia Radzhabova 2022-10-12 15:47:35 +03:00
parent 3023a140d9
commit fcd49ec483

View file

@ -211,22 +211,22 @@ define([
this.getImage = function(index, canvas, ctx) { this.getImage = function(index, canvas, ctx) {
//var t1 = performance.now(); //var t1 = performance.now();
if (!canvas)
{
canvas = document.createElement("canvas");
canvas.width = this.width;
canvas.height = this.heightOne;
canvas.style.width = iconWidth + "px";
canvas.style.height = iconHeight + "px";
ctx = canvas.getContext("2d");
}
if (this.supportBinaryFormat) { if (this.supportBinaryFormat) {
if (!this.data && !this.offsets) { if (!this.data && !this.offsets) {
this.openBinary(this.binaryFormat); this.openBinary(this.binaryFormat);
} }
if (!canvas)
{
canvas = document.createElement("canvas");
canvas.width = this.width;
canvas.height = this.heightOne;
canvas.style.width = iconWidth + "px";
canvas.style.height = iconHeight + "px";
ctx = canvas.getContext("2d");
}
var dataTmp = ctx.createImageData(this.width, this.heightOne); var dataTmp = ctx.createImageData(this.width, this.heightOne);
var sizeImage = 4 * this.width * this.heightOne; var sizeImage = 4 * this.width * this.heightOne;
@ -272,6 +272,17 @@ define([
} }
ctx.putImageData(dataTmp, 0, 0); ctx.putImageData(dataTmp, 0, 0);
} else { } else {
if (!canvas)
{
canvas = document.createElement("canvas");
canvas.width = this.width;
canvas.height = this.heightOne;
canvas.style.width = iconWidth + "px";
canvas.style.height = iconHeight + "px";
ctx = canvas.getContext("2d");
}
ctx.clearRect(0, 0, this.width, this.heightOne); ctx.clearRect(0, 0, this.width, this.heightOne);
ctx.drawImage(this.image, 0, -this.heightOne * index); ctx.drawImage(this.image, 0, -this.heightOne * index);
} }