mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 09:20:06 +02:00
Introduce a viewer constant for document.documentElement.style
Over time, as we've been introducing JavaScript code to modify CSS variables, we've been adding shorthand properties to various classes to reduce unnecessary repetition when accessing the document-styles. Rather than repeating this in multiple places, it seems overall simpler to just introduce a constant and re-use that throughout the viewer instead.
This commit is contained in:
parent
5b02c685d6
commit
ca244d9bca
5 changed files with 21 additions and 13 deletions
|
@ -17,6 +17,7 @@ import {
|
|||
animationStarted,
|
||||
DEFAULT_SCALE,
|
||||
DEFAULT_SCALE_VALUE,
|
||||
docStyle,
|
||||
MAX_SCALE,
|
||||
MIN_SCALE,
|
||||
noContextMenuHandler,
|
||||
|
@ -274,8 +275,7 @@ class Toolbar {
|
|||
maxWidth += 2 * scaleSelectOverflow;
|
||||
|
||||
if (maxWidth > scaleSelectContainerWidth) {
|
||||
const doc = document.documentElement;
|
||||
doc.style.setProperty("--scale-select-container-width", `${maxWidth}px`);
|
||||
docStyle.setProperty("--scale-select-container-width", `${maxWidth}px`);
|
||||
}
|
||||
// Zeroing the width and height cause Firefox to release graphics resources
|
||||
// immediately, which can greatly reduce memory consumption.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue