Scale text divs instead of letterspacing
This commit is contained in:
parent
5e50825503
commit
ffa0e082a4
@ -1041,12 +1041,11 @@ var TextLayerBuilder = function textLayerBuilder(textLayerDiv) {
|
|||||||
textLayerDiv.appendChild(textDiv);
|
textLayerDiv.appendChild(textDiv);
|
||||||
|
|
||||||
if (textDiv.dataset.textLength > 1) { // avoid div by zero
|
if (textDiv.dataset.textLength > 1) { // avoid div by zero
|
||||||
// Adjust div width (via letterSpacing) to match canvas text
|
// Adjust div width to match canvas text
|
||||||
// Due to the .offsetWidth calls, this is slow
|
// Due to the .offsetWidth calls, this is slow
|
||||||
// This needs to come after appending to the DOM
|
// This needs to come after appending to the DOM
|
||||||
textDiv.style.letterSpacing =
|
textDiv.style.MozTransform = 'scale(' + textDiv.dataset.canvasWidth/textDiv.offsetWidth + ',1)';
|
||||||
((textDiv.dataset.canvasWidth - textDiv.offsetWidth) /
|
textDiv.style.MozTransformOrigin = '0% 0%';
|
||||||
(textDiv.dataset.textLength - 1)) + 'px';
|
|
||||||
}
|
}
|
||||||
} // textLength > 0
|
} // textLength > 0
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user