From 412502370d2efee794d934524ade39a1ddfe79c8 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Thu, 30 Nov 2023 20:29:40 +0100 Subject: [PATCH] Remove the "transitionend" event listener from the default viewer (issue 17347) Given that this event listener is only used to trigger rendering after the sidebar has been opened/closed, we can utilize the existing one in the `PDFSidebar` class for this purpose instead. That one is registered on the sidebar DOM-element, and is needed to remove a CSS-class indicating that the sidebar is moving. --- web/app.js | 10 ---------- web/pdf_sidebar.js | 2 ++ 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/web/app.js b/web/app.js index 253a6d78f..3bb2eb6e1 100644 --- a/web/app.js +++ b/web/app.js @@ -689,16 +689,6 @@ const PDFViewerApplication = { appConfig.toolbar?.viewFind?.classList.add("hidden"); } - appConfig.mainContainer.addEventListener( - "transitionend", - function (evt) { - if (evt.target === /* mainContainer */ this) { - eventBus.dispatch("resize", { source: this }); - } - }, - true - ); - if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) { if (file) { this.open({ url: file }); diff --git a/web/pdf_sidebar.js b/web/pdf_sidebar.js index 394c4e322..50e319de7 100644 --- a/web/pdf_sidebar.js +++ b/web/pdf_sidebar.js @@ -329,6 +329,8 @@ class PDFSidebar { this.sidebarContainer.addEventListener("transitionend", evt => { if (evt.target === this.sidebarContainer) { this.outerContainer.classList.remove("sidebarMoving"); + // Ensure that rendering is triggered after opening/closing the sidebar. + this.eventBus.dispatch("resize", { source: this }); } });