Let the loadingBar have the same width as the viewerContainer
For years the loadingBar and sidebarContainer has had a slightly annoying and unfortunate dependency, since the loadingBar width follows the main toolbar width[1]. To prevent the loadingBar from obscuring part of the sidebarContainer, especially the buttons, the sidebarContainer is thus moved down when the loadingBar is visible. This has always annoyed me[2], since it means that the buttons in the sidebar may thus move vertically which seems bad from a UX perspective. Now that CSS variables are available in all supported browsers[3] however, fixing the loadingBar/sidebarContainer overlap issues are finally easy. The solution is simply to let the sidebarContainer, when visible, control the loadingBar left position (right in RTL locales) in the same way that the viewerContainer is handled. Hence the sidebarContainer can now have a *consistent* vertical postition, without the loadingBar overlapping it. --- [1] Obviously the right position (left in RTL locales) of the loadingBar is, potentially, reduced to account for a scrollbar. [2] I've tried to fix this a few times, but it always seemed like more trouble than it's worth. [3] https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties#Browser_compatibility
This commit is contained in:
parent
865de9ab90
commit
17a507016a
@ -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,
|
||||
@ -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`);
|
||||
}
|
||||
}
|
||||
|
||||
@ -950,7 +953,6 @@ class ProgressBar {
|
||||
}
|
||||
this.visible = false;
|
||||
this.bar.classList.add("hidden");
|
||||
document.body.classList.remove("loadingInProgress");
|
||||
}
|
||||
|
||||
show() {
|
||||
@ -958,7 +960,6 @@ class ProgressBar {
|
||||
return;
|
||||
}
|
||||
this.visible = true;
|
||||
document.body.classList.add("loadingInProgress");
|
||||
this.bar.classList.remove("hidden");
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
@ -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;
|
||||
@ -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 {
|
||||
@ -1485,9 +1506,6 @@ html[dir="rtl"] .treeItemToggler::before {
|
||||
z-index: 1000;
|
||||
padding: 3px 6px;
|
||||
}
|
||||
.loadingInProgress #errorWrapper {
|
||||
top: 37px;
|
||||
}
|
||||
|
||||
#errorMessageLeft {
|
||||
float: left;
|
||||
|
@ -71,7 +71,7 @@ See https://github.com/adobe-type-tools/cmap-resources
|
||||
|
||||
</head>
|
||||
|
||||
<body tabindex="1" class="loadingInProgress">
|
||||
<body tabindex="1">
|
||||
<div id="outerContainer">
|
||||
|
||||
<div id="sidebarContainer">
|
||||
|
Loading…
x
Reference in New Issue
Block a user