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.
This commit is contained in:
Jonas Jenwald 2023-11-30 20:29:40 +01:00
parent 9ac1ac6ed3
commit 412502370d
2 changed files with 2 additions and 10 deletions

View File

@ -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 });

View File

@ -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 });
}
});