Only warn about missing --scale-factor
CSS-variable for visible textLayers (PR 16162 follow-up)
This is something that I completely overlooked in PR 16162, which in some cases cause the default viewer to incorrectly print warnings. This can be reproduced with the PAGE scrolling-mode, and/or the PresentationMode, and this patch simply work-around it by checking the visibility as well (since the warning is a best-effort solution anyway).
This commit is contained in:
parent
fb2367d14f
commit
8bf5e96af9
@ -470,9 +470,13 @@ function renderTextLayer(params) {
|
|||||||
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("GENERIC && !TESTING")) {
|
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("GENERIC && !TESTING")) {
|
||||||
const { container, viewport } = params;
|
const { container, viewport } = params;
|
||||||
const style = getComputedStyle(container);
|
const style = getComputedStyle(container);
|
||||||
|
const visibility = style.getPropertyValue("visibility");
|
||||||
const scaleFactor = parseFloat(style.getPropertyValue("--scale-factor"));
|
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(
|
console.error(
|
||||||
"The `--scale-factor` CSS-variable must be set, " +
|
"The `--scale-factor` CSS-variable must be set, " +
|
||||||
"to the same value as `viewport.scale`, " +
|
"to the same value as `viewport.scale`, " +
|
||||||
|
Loading…
Reference in New Issue
Block a user