Merge pull request #16181 from Snuffleupagus/pr-16162

Only warn about missing `--scale-factor` CSS-variable for visible textLayers (PR 16162 follow-up)
This commit is contained in:
Jonas Jenwald 2023-03-20 14:21:37 +01:00 committed by GitHub
commit a29c131e90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -470,9 +470,13 @@ function renderTextLayer(params) {
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("GENERIC && !TESTING")) {
const { container, viewport } = params;
const style = getComputedStyle(container);
const visibility = style.getPropertyValue("visibility");
const scaleFactor = parseFloat(style.getPropertyValue("--scale-factor"));
if (!scaleFactor || Math.abs(scaleFactor - viewport.scale) > 1e-15) {
if (
visibility === "visible" &&
(!scaleFactor || Math.abs(scaleFactor - viewport.scale) > 1e-15)
) {
console.error(
"The `--scale-factor` CSS-variable must be set, " +
"to the same value as `viewport.scale`, " +