Always remove the sidebarMoving CSS class when the sidebar is closed

When the viewer becomes narrow enough that the sidebar is overlaying the document, which means that the `viewerContainer` is not moving when opening/closing the sidebar, we're currently not removing the `sidebarMoving` CSS class as intended.
While this doesn't cause any *visible* issues, it's nonetheless wrong and should be fixed.
This commit is contained in:
Jonas Jenwald 2022-04-11 10:28:51 +02:00
parent 143ba30bef
commit 0fbe5832ab
2 changed files with 6 additions and 6 deletions

View File

@ -34,8 +34,8 @@ const UI_NOTIFICATION_CLASS = "pdfSidebarNotification";
* @typedef {Object} PDFSidebarElements * @typedef {Object} PDFSidebarElements
* @property {HTMLDivElement} outerContainer - The outer container * @property {HTMLDivElement} outerContainer - The outer container
* (encasing both the viewer and sidebar elements). * (encasing both the viewer and sidebar elements).
* @property {HTMLDivElement} viewerContainer - The viewer container * @property {HTMLDivElement} sidebarContainer - The sidebar container
* (in which the viewer element is placed). * (in which the views are placed).
* @property {HTMLButtonElement} toggleButton - The button used for * @property {HTMLButtonElement} toggleButton - The button used for
* opening/closing the sidebar. * opening/closing the sidebar.
* @property {HTMLButtonElement} thumbnailButton - The button used to show * @property {HTMLButtonElement} thumbnailButton - The button used to show
@ -79,7 +79,7 @@ class PDFSidebar {
this.pdfThumbnailViewer = pdfThumbnailViewer; this.pdfThumbnailViewer = pdfThumbnailViewer;
this.outerContainer = elements.outerContainer; this.outerContainer = elements.outerContainer;
this.viewerContainer = elements.viewerContainer; this.sidebarContainer = elements.sidebarContainer;
this.toggleButton = elements.toggleButton; this.toggleButton = elements.toggleButton;
this.thumbnailButton = elements.thumbnailButton; this.thumbnailButton = elements.thumbnailButton;
@ -369,8 +369,8 @@ class PDFSidebar {
* @private * @private
*/ */
_addEventListeners() { _addEventListeners() {
this.viewerContainer.addEventListener("transitionend", evt => { this.sidebarContainer.addEventListener("transitionend", evt => {
if (evt.target === this.viewerContainer) { if (evt.target === this.sidebarContainer) {
this.outerContainer.classList.remove("sidebarMoving"); this.outerContainer.classList.remove("sidebarMoving");
} }
}); });

View File

@ -125,7 +125,7 @@ function getViewerConfiguration() {
sidebar: { sidebar: {
// Divs (and sidebar button) // Divs (and sidebar button)
outerContainer: document.getElementById("outerContainer"), outerContainer: document.getElementById("outerContainer"),
viewerContainer: document.getElementById("viewerContainer"), sidebarContainer: document.getElementById("sidebarContainer"),
toggleButton: document.getElementById("sidebarToggle"), toggleButton: document.getElementById("sidebarToggle"),
// Buttons // Buttons
thumbnailButton: document.getElementById("viewThumbnail"), thumbnailButton: document.getElementById("viewThumbnail"),