mirror of
https://github.com/zen-browser/desktop.git
synced 2025-10-06 18:06:35 +00:00
Refactor workspace icon handling and improve animation state management
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
#currentBrowser = null;
|
||||
#currentTab = null;
|
||||
|
||||
#animating = false;
|
||||
_animating = false;
|
||||
|
||||
init() {
|
||||
document.documentElement.setAttribute('zen-glance-uuid', gZenUIManager.generateUuidv4());
|
||||
@@ -86,6 +86,8 @@
|
||||
const currentTab = gBrowser.selectedTab;
|
||||
|
||||
this.animatingOpen = true;
|
||||
this._animating = true;
|
||||
|
||||
const browserElement = this.createBrowserElement(url, currentTab);
|
||||
|
||||
this.overlay = browserElement.closest('.browserSidebarContainer');
|
||||
@@ -107,18 +109,17 @@
|
||||
|
||||
this.overlay.removeAttribute('fade-out');
|
||||
this.browserWrapper.setAttribute('animate', true);
|
||||
this.#animating = true;
|
||||
setTimeout(() => {
|
||||
this.browserWrapper.setAttribute('animate-end', true);
|
||||
this.browserWrapper.setAttribute('has-finished-animation', true);
|
||||
this.#animating = false;
|
||||
this._animating = false;
|
||||
this.animatingOpen = false;
|
||||
}, 500);
|
||||
});
|
||||
}
|
||||
|
||||
closeGlance({ noAnimation = false, onTabClose = false } = {}) {
|
||||
if (this.#animating || !this.#currentBrowser || this.animatingOpen || this._duringOpening) {
|
||||
if (this._animating || !this.#currentBrowser || this.animatingOpen || this._duringOpening) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -130,6 +131,8 @@
|
||||
return;
|
||||
}
|
||||
|
||||
this._animating = true;
|
||||
|
||||
gBrowser._insertTabAtIndex(this.#currentTab, {
|
||||
index: this.currentParentTab._tPos + 1,
|
||||
});
|
||||
@@ -195,6 +198,8 @@
|
||||
|
||||
this.lastCurrentTab = null;
|
||||
this._duringOpening = false;
|
||||
|
||||
this._animating = false;
|
||||
}, 400);
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user