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