Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let the loadingBar have the same width as the viewerContainer #12362

Merged
merged 1 commit into from
Sep 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions web/ui_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ const MAX_AUTO_SCALE = 1.25;
const SCROLLBAR_PADDING = 40;
const VERTICAL_PADDING = 5;

const LOADINGBAR_END_OFFSET_VAR = "--loadingBar-end-offset";

const PresentationModeState = {
UNKNOWN: 0,
NORMAL: 1,
Expand Down Expand Up @@ -940,7 +942,8 @@ class ProgressBar {
const container = viewer.parentNode;
const scrollbarWidth = container.offsetWidth - viewer.offsetWidth;
if (scrollbarWidth > 0) {
this.bar.style.width = `calc(100% - ${scrollbarWidth}px)`;
const doc = document.documentElement;
doc.style.setProperty(LOADINGBAR_END_OFFSET_VAR, `${scrollbarWidth}px`);
}
}

Expand All @@ -950,15 +953,13 @@ class ProgressBar {
}
this.visible = false;
this.bar.classList.add("hidden");
document.body.classList.remove("loadingInProgress");
}

show() {
if (this.visible) {
return;
}
this.visible = true;
document.body.classList.add("loadingInProgress");
this.bar.classList.remove("hidden");
}
}
Expand Down
36 changes: 27 additions & 9 deletions web/viewer.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
--sidebar-width: 200px;
--sidebar-transition-duration: 200ms;
--sidebar-transition-timing-function: ease;
--loadingBar-end-offset: 0;

--toolbar-icon-opacity: 0.7;
--doorhanger-icon-opacity: 0.9;
Expand Down Expand Up @@ -253,10 +254,6 @@ html[dir="rtl"] #sidebarContainer {
right: calc(0px - var(--sidebar-width));
}

.loadingInProgress #sidebarContainer {
top: 36px;
}

#outerContainer.sidebarResizing #sidebarContainer {
/* Improve responsiveness and avoid visual glitches when the sidebar is resized. */
transition-duration: 0s;
Expand Down Expand Up @@ -406,11 +403,35 @@ html[dir="rtl"] #toolbarContainer,
}

#loadingBar {
position: relative;
width: 100%;
position: absolute;
height: 4px;
background-color: var(--body-bg-color);
border-bottom: 1px solid var(--toolbar-border-color);

transition-duration: var(--sidebar-transition-duration);
transition-timing-function: var(--sidebar-transition-timing-function);
}
html[dir="ltr"] #loadingBar {
transition-property: left;
left: 0;
right: var(--loadingBar-end-offset);
}
html[dir="rtl"] #loadingBar {
transition-property: right;
left: var(--loadingBar-end-offset);
right: 0;
}

html[dir="ltr"] #outerContainer.sidebarOpen #loadingBar {
left: var(--sidebar-width);
}
html[dir="rtl"] #outerContainer.sidebarOpen #loadingBar {
right: var(--sidebar-width);
}

#outerContainer.sidebarResizing #loadingBar {
/* Improve responsiveness and avoid visual glitches when the sidebar is resized. */
transition-duration: 0s;
}

#loadingBar .progress {
Expand Down Expand Up @@ -1485,9 +1506,6 @@ html[dir="rtl"] .treeItemToggler::before {
z-index: 1000;
padding: 3px 6px;
}
.loadingInProgress #errorWrapper {
top: 37px;
}

#errorMessageLeft {
float: left;
Expand Down
2 changes: 1 addition & 1 deletion web/viewer.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@

</head>

<body tabindex="1" class="loadingInProgress">
<body tabindex="1">
<div id="outerContainer">

<div id="sidebarContainer">
Expand Down