Append entire DOM fragment at once.

This commit is contained in:
Brendan Dahl 2013-11-26 11:01:28 -08:00
parent 49082cf93e
commit 9ac950f9a8

View File

@ -76,27 +76,24 @@ var TextLayerBuilder = function textLayerBuilder(options) {
if ('isWhitespace' in textDiv.dataset) {
continue;
}
textLayerFrag.appendChild(textDiv);
ctx.font = textDiv.style.fontSize + ' ' + textDiv.style.fontFamily;
var width = ctx.measureText(textDiv.textContent).width;
if (width > 0) {
textLayerFrag.appendChild(textDiv);
var textScale = textDiv.dataset.canvasWidth / width;
var rotation = textDiv.dataset.angle;
var transform = 'scale(' + textScale + ', 1)';
transform = 'rotate(' + rotation + 'deg) ' + transform;
CustomStyle.setProp('transform' , textDiv, transform);
CustomStyle.setProp('transformOrigin' , textDiv, '0% 0%');
textLayerDiv.appendChild(textDiv);
}
}
textLayerDiv.appendChild(textLayerFrag);
this.renderingDone = true;
this.updateMatches();
textLayerDiv.appendChild(textLayerFrag);
};
this.setupRenderLayoutTimer = function textLayerSetupRenderLayoutTimer() {