Use template strings when calculating the CSS transforms, in the PDFPageView.cssTransform method

In my opinion this slightly improves readability, by grouping related properties together.
This commit is contained in:
Jonas Jenwald 2020-09-23 19:03:20 +02:00
parent 8467f45ab7
commit 2043596035

View File

@ -349,16 +349,7 @@ class PDFPageView {
scaleX = height / width;
scaleY = width / height;
}
const cssTransform =
"rotate(" +
relativeRotation +
"deg) " +
"scale(" +
scaleX +
"," +
scaleY +
")";
target.style.transform = cssTransform;
target.style.transform = `rotate(${relativeRotation}deg) scale(${scaleX}, ${scaleY})`;
if (this.textLayer) {
// Rotating the text layer is more complicated since the divs inside the
@ -397,19 +388,9 @@ class PDFPageView {
}
textLayerDiv.style.transform =
"rotate(" +
textAbsRotation +
"deg) " +
"scale(" +
scale +
", " +
scale +
") " +
"translate(" +
transX +
", " +
transY +
")";
`rotate(${textAbsRotation}deg) ` +
`scale(${scale}) ` +
`translate(${transX}, ${transY})`;
textLayerDiv.style.transformOrigin = "0% 0%";
}