Merge pull request #15960 from Snuffleupagus/issue-15958

Move `ProgressBar`-related CSS variables into the `loadingBar` DOM-element (issue 15958)
This commit is contained in:
Jonas Jenwald 2023-01-25 12:17:24 +01:00 committed by GitHub
commit 1b1ebf6a77
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 8 deletions

View file

@ -696,10 +696,13 @@ class ProgressBar {
#percent = 0;
#style = null;
#visible = true;
constructor(bar) {
this.#classList = bar.classList;
this.#style = bar.style;
}
get percent() {
@ -715,7 +718,7 @@ class ProgressBar {
}
this.#classList.remove("indeterminate");
docStyle.setProperty("--progressBar-percent", `${this.#percent}%`);
this.#style.setProperty("--progressBar-percent", `${this.#percent}%`);
}
setWidth(viewer) {
@ -725,7 +728,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`
);
}
}