Refactor ZenGlanceManager.mjs to remove unnecessary attribute and improve animation handling

This commit is contained in:
mr. M 2024-10-30 17:16:24 +01:00
parent 5daa3ffa53
commit 5d631354e5
No known key found for this signature in database
GPG key ID: CBD57A2AEDBDA1FB

View file

@ -99,6 +99,7 @@
this.browserWrapper.removeAttribute("animate-end"); this.browserWrapper.removeAttribute("animate-end");
this.browserWrapper.removeAttribute("animate-full"); this.browserWrapper.removeAttribute("animate-full");
this.browserWrapper.removeAttribute("animate-full-end"); this.browserWrapper.removeAttribute("animate-full-end");
this.browserWrapper.removeAttribute("has-finished-animation");
const url = data.url; const url = data.url;
const currentTab = gBrowser.selectedTab; const currentTab = gBrowser.selectedTab;
@ -130,6 +131,7 @@
this.#animating = true; this.#animating = true;
setTimeout(() => { setTimeout(() => {
this.browserWrapper.setAttribute("animate-end", true); this.browserWrapper.setAttribute("animate-end", true);
this.browserWrapper.setAttribute("has-finished-animation", true);
this.#animating = false; this.#animating = false;
}, 400); }, 400);
}); });
@ -140,6 +142,7 @@
return; return;
} }
this.browserWrapper.removeAttribute("has-finished-animation");
if (noAnimation) { if (noAnimation) {
this.overlay.style.opacity = 0; this.overlay.style.opacity = 0;
this.overlay.visivility = "collapse"; this.overlay.visivility = "collapse";
@ -208,6 +211,7 @@
this.animatingFullOpen = true; this.animatingFullOpen = true;
this.browserWrapper.removeAttribute("has-finished-animation");
this.browserWrapper.setAttribute("animate-full", true); this.browserWrapper.setAttribute("animate-full", true);
setTimeout(() => { setTimeout(() => {
window.requestAnimationFrame(() => { window.requestAnimationFrame(() => {