mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 01:10:08 +02:00
Move ProgressBar
-related CSS variables into the loadingBar
DOM-element (issue 15958)
This way we avoid reflowing the entire viewer when e.g. updating the loading progress.
This commit is contained in:
parent
0b9d32bdad
commit
9d5085347a
3 changed files with 17 additions and 8 deletions
|
@ -697,10 +697,13 @@ class ProgressBar {
|
|||
|
||||
#percent = 0;
|
||||
|
||||
#style = null;
|
||||
|
||||
#visible = true;
|
||||
|
||||
constructor(bar) {
|
||||
this.#classList = bar.classList;
|
||||
this.#style = bar.style;
|
||||
}
|
||||
|
||||
get percent() {
|
||||
|
@ -716,7 +719,7 @@ class ProgressBar {
|
|||
}
|
||||
this.#classList.remove("indeterminate");
|
||||
|
||||
docStyle.setProperty("--progressBar-percent", `${this.#percent}%`);
|
||||
this.#style.setProperty("--progressBar-percent", `${this.#percent}%`);
|
||||
}
|
||||
|
||||
setWidth(viewer) {
|
||||
|
@ -726,7 +729,10 @@ class ProgressBar {
|
|||
const container = viewer.parentNode;
|
||||
const scrollbarWidth = container.offsetWidth - viewer.offsetWidth;
|
||||
if (scrollbarWidth > 0) {
|
||||
docStyle.setProperty("--progressBar-end-offset", `${scrollbarWidth}px`);
|
||||
this.#style.setProperty(
|
||||
"--progressBar-end-offset",
|
||||
`${scrollbarWidth}px`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue