Append whitespace divs so matches still line up.

This commit is contained in:
Brendan Dahl 2014-04-10 14:01:21 -07:00
parent 36d63a2313
commit 5ba674c996

View File

@ -112,6 +112,7 @@ var TextLayerBuilder = function textLayerBuilder(options) {
this.appendText = function textLayerBuilderAppendText(geom, styles) { this.appendText = function textLayerBuilderAppendText(geom, styles) {
var style = styles[geom.fontName]; var style = styles[geom.fontName];
var textDiv = document.createElement('div'); var textDiv = document.createElement('div');
this.textDivs.push(textDiv);
if (!/\S/.test(geom.str)) { if (!/\S/.test(geom.str)) {
textDiv.dataset.isWhitespace = true; textDiv.dataset.isWhitespace = true;
return; return;
@ -140,7 +141,6 @@ var TextLayerBuilder = function textLayerBuilder(options) {
textDiv.dataset.canvasWidth = geom.width * this.viewport.scale; textDiv.dataset.canvasWidth = geom.width * this.viewport.scale;
} }
this.textDivs.push(textDiv);
}; };
this.setTextContent = function textLayerBuilderSetTextContent(textContent) { this.setTextContent = function textLayerBuilderSetTextContent(textContent) {