Ensure single chars are added to the layer
This commit is contained in:
parent
499a9b0146
commit
5f4d462144
@ -974,13 +974,13 @@ var TextLayerBuilder = function textLayerBuilder(textLayerDiv) {
|
|||||||
}
|
}
|
||||||
var textDiv = textDivs.shift();
|
var textDiv = textDivs.shift();
|
||||||
if (textDiv.dataset.textLength > 1) { // avoid div by zero
|
if (textDiv.dataset.textLength > 1) { // avoid div by zero
|
||||||
textLayerDiv.appendChild(textDiv);
|
|
||||||
// Adjust div width (via letterSpacing) to match canvas text
|
// Adjust div width (via letterSpacing) to match canvas text
|
||||||
// Due to the .offsetWidth calls, this is slow
|
// Due to the .offsetWidth calls, this is slow
|
||||||
textDiv.style.letterSpacing =
|
textDiv.style.letterSpacing =
|
||||||
((textDiv.dataset.canvasWidth - textDiv.offsetWidth) /
|
((textDiv.dataset.canvasWidth - textDiv.offsetWidth) /
|
||||||
(textDiv.dataset.textLength - 1)) + 'px';
|
(textDiv.dataset.textLength - 1)) + 'px';
|
||||||
}
|
}
|
||||||
|
textLayerDiv.appendChild(textDiv);
|
||||||
}
|
}
|
||||||
renderTimer = setInterval(renderTextLayer, renderInterval);
|
renderTimer = setInterval(renderTextLayer, renderInterval);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user