Append entire DOM fragment at once.
This commit is contained in:
parent
49082cf93e
commit
9ac950f9a8
@ -76,27 +76,24 @@ var TextLayerBuilder = function textLayerBuilder(options) {
|
|||||||
if ('isWhitespace' in textDiv.dataset) {
|
if ('isWhitespace' in textDiv.dataset) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
textLayerFrag.appendChild(textDiv);
|
|
||||||
|
|
||||||
ctx.font = textDiv.style.fontSize + ' ' + textDiv.style.fontFamily;
|
ctx.font = textDiv.style.fontSize + ' ' + textDiv.style.fontFamily;
|
||||||
var width = ctx.measureText(textDiv.textContent).width;
|
var width = ctx.measureText(textDiv.textContent).width;
|
||||||
|
|
||||||
if (width > 0) {
|
if (width > 0) {
|
||||||
|
textLayerFrag.appendChild(textDiv);
|
||||||
var textScale = textDiv.dataset.canvasWidth / width;
|
var textScale = textDiv.dataset.canvasWidth / width;
|
||||||
var rotation = textDiv.dataset.angle;
|
var rotation = textDiv.dataset.angle;
|
||||||
var transform = 'scale(' + textScale + ', 1)';
|
var transform = 'scale(' + textScale + ', 1)';
|
||||||
transform = 'rotate(' + rotation + 'deg) ' + transform;
|
transform = 'rotate(' + rotation + 'deg) ' + transform;
|
||||||
CustomStyle.setProp('transform' , textDiv, transform);
|
CustomStyle.setProp('transform' , textDiv, transform);
|
||||||
CustomStyle.setProp('transformOrigin' , textDiv, '0% 0%');
|
CustomStyle.setProp('transformOrigin' , textDiv, '0% 0%');
|
||||||
|
|
||||||
textLayerDiv.appendChild(textDiv);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
textLayerDiv.appendChild(textLayerFrag);
|
||||||
this.renderingDone = true;
|
this.renderingDone = true;
|
||||||
this.updateMatches();
|
this.updateMatches();
|
||||||
|
|
||||||
textLayerDiv.appendChild(textLayerFrag);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.setupRenderLayoutTimer = function textLayerSetupRenderLayoutTimer() {
|
this.setupRenderLayoutTimer = function textLayerSetupRenderLayoutTimer() {
|
||||||
|
Loading…
Reference in New Issue
Block a user