[TextLayer] Only cache the current textDiv
style when enhanceTextSelection
is enabled
This will help save a little bit of memory, by not storing one unused string for each `textDiv` in regular text-selection mode.
This commit is contained in:
parent
852fc955bd
commit
45dfad8640
@ -90,8 +90,7 @@ var renderTextLayer = (function renderTextLayerClosure() {
|
|||||||
fontAscent = (1 + style.descent) * fontAscent;
|
fontAscent = (1 + style.descent) * fontAscent;
|
||||||
}
|
}
|
||||||
|
|
||||||
var left;
|
let left, top;
|
||||||
var top;
|
|
||||||
if (angle === 0) {
|
if (angle === 0) {
|
||||||
left = tx[4];
|
left = tx[4];
|
||||||
top = tx[5] - fontAscent;
|
top = tx[5] - fontAscent;
|
||||||
@ -103,8 +102,12 @@ var renderTextLayer = (function renderTextLayerClosure() {
|
|||||||
styleBuf[3] = top;
|
styleBuf[3] = top;
|
||||||
styleBuf[5] = fontHeight;
|
styleBuf[5] = fontHeight;
|
||||||
styleBuf[7] = style.fontFamily;
|
styleBuf[7] = style.fontFamily;
|
||||||
textDivProperties.style = styleBuf.join('');
|
const styleStr = styleBuf.join('');
|
||||||
textDiv.setAttribute('style', textDivProperties.style);
|
|
||||||
|
if (task._enhanceTextSelection) {
|
||||||
|
textDivProperties.style = styleStr;
|
||||||
|
}
|
||||||
|
textDiv.setAttribute('style', styleStr);
|
||||||
|
|
||||||
textDiv.textContent = geom.str;
|
textDiv.textContent = geom.str;
|
||||||
// `fontName` is only used by the FontInspector, and we only use `dataset`
|
// `fontName` is only used by the FontInspector, and we only use `dataset`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user