Merge pull request #11086 from Snuffleupagus/textLayer-originalTransform
[TextLayer] Only cache the `originalTransform` when `enhanceTextSelection` is enabled
This commit is contained in:
commit
490deb1b65
@ -537,14 +537,12 @@ var renderTextLayer = (function renderTextLayerClosure() {
|
|||||||
if (textDivProperties.isWhitespace) {
|
if (textDivProperties.isWhitespace) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const { fontSize, fontFamily, } = textDiv.style;
|
||||||
let fontSize = textDiv.style.fontSize;
|
|
||||||
let fontFamily = textDiv.style.fontFamily;
|
|
||||||
|
|
||||||
// Only build font string and set to context if different from last.
|
// Only build font string and set to context if different from last.
|
||||||
if (fontSize !== this._layoutTextLastFontSize ||
|
if (fontSize !== this._layoutTextLastFontSize ||
|
||||||
fontFamily !== this._layoutTextLastFontFamily) {
|
fontFamily !== this._layoutTextLastFontFamily) {
|
||||||
this._layoutTextCtx.font = fontSize + ' ' + fontFamily;
|
this._layoutTextCtx.font = `${fontSize} ${fontFamily}`;
|
||||||
this._layoutTextLastFontSize = fontSize;
|
this._layoutTextLastFontSize = fontSize;
|
||||||
this._layoutTextLastFontFamily = fontFamily;
|
this._layoutTextLastFontFamily = fontFamily;
|
||||||
}
|
}
|
||||||
@ -560,7 +558,9 @@ var renderTextLayer = (function renderTextLayerClosure() {
|
|||||||
transform = `rotate(${textDivProperties.angle}deg) ${transform}`;
|
transform = `rotate(${textDivProperties.angle}deg) ${transform}`;
|
||||||
}
|
}
|
||||||
if (transform.length > 0) {
|
if (transform.length > 0) {
|
||||||
textDivProperties.originalTransform = transform;
|
if (this._enhanceTextSelection) {
|
||||||
|
textDivProperties.originalTransform = transform;
|
||||||
|
}
|
||||||
textDiv.style.transform = transform;
|
textDiv.style.transform = transform;
|
||||||
}
|
}
|
||||||
this._textDivProperties.set(textDiv, textDivProperties);
|
this._textDivProperties.set(textDiv, textDivProperties);
|
||||||
@ -668,8 +668,8 @@ var renderTextLayer = (function renderTextLayerClosure() {
|
|||||||
div.style.transform = transform;
|
div.style.transform = transform;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
div.style.padding = 0;
|
div.style.padding = null;
|
||||||
div.style.transform = divProps.originalTransform || '';
|
div.style.transform = divProps.originalTransform;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user