mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-10 02:05:37 +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
|
@ -13,6 +13,8 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { docStyle } from "./ui_utils.js";
|
||||
|
||||
const SIDEBAR_WIDTH_VAR = "--sidebar-width";
|
||||
const SIDEBAR_MIN_WIDTH = 200; // pixels
|
||||
const SIDEBAR_RESIZING_CLASS = "sidebarResizing";
|
||||
|
@ -34,7 +36,6 @@ class PDFSidebarResizer {
|
|||
constructor(options, eventBus, l10n) {
|
||||
this.isRTL = false;
|
||||
this.sidebarOpen = false;
|
||||
this.doc = document.documentElement;
|
||||
this._width = null;
|
||||
this._outerContainerWidth = null;
|
||||
this._boundEvents = Object.create(null);
|
||||
|
@ -75,7 +76,8 @@ class PDFSidebarResizer {
|
|||
return false;
|
||||
}
|
||||
this._width = width;
|
||||
this.doc.style.setProperty(SIDEBAR_WIDTH_VAR, `${width}px`);
|
||||
|
||||
docStyle.setProperty(SIDEBAR_WIDTH_VAR, `${width}px`);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue