mirror of
https://github.com/zen-browser/desktop.git
synced 2025-10-07 02:16:36 +00:00
Refactor workspace icon handling and improve animation state management
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -65,7 +65,7 @@ var gZenCompactModeManager = {
|
||||
},
|
||||
|
||||
flashSidebarIfNecessary(aInstant = false) {
|
||||
if (!aInstant && this.prefefence && lazyCompactMode.COMPACT_MODE_FLASH_ENABLED && !gZenGlanceManager.animatingOpen) {
|
||||
if (!aInstant && this.prefefence && lazyCompactMode.COMPACT_MODE_FLASH_ENABLED && !gZenGlanceManager._animating) {
|
||||
this.flashSidebar();
|
||||
}
|
||||
},
|
||||
|
@@ -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);
|
||||
});
|
||||
});
|
||||
|
@@ -463,10 +463,6 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
return tab;
|
||||
}
|
||||
|
||||
_kIcons = JSON.parse(Services.prefs.getStringPref('zen.workspaces.icons')).map((icon) =>
|
||||
typeof Intl.Segmenter !== 'undefined' ? new Intl.Segmenter().segment(icon).containing().segment : Array.from(icon)[0]
|
||||
);
|
||||
|
||||
searchIcons(input, icons) {
|
||||
input = input.toLowerCase();
|
||||
|
||||
@@ -543,7 +539,8 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
let container = document.getElementById('PanelUI-zen-workspaces-icon-picker-wrapper');
|
||||
let searchInput = document.getElementById('PanelUI-zen-workspaces-icon-search-input');
|
||||
searchInput.value = '';
|
||||
for (let icon of this._kIcons) {
|
||||
for (let iconData of this.emojis) {
|
||||
const icon = iconData[0];
|
||||
let button = document.createXULElement('toolbarbutton');
|
||||
button.className = 'toolbarbutton-1 workspace-icon-button';
|
||||
button.setAttribute('label', icon);
|
||||
@@ -621,7 +618,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
let parentPanel = document.getElementById('PanelUI-zen-workspaces-multiview');
|
||||
|
||||
// randomly select an icon
|
||||
let icon = this._kIcons[Math.floor(Math.random() * this._kIcons.length)];
|
||||
let icon = this.emojis[Math.floor(Math.random() * this.emojis.length)][0];
|
||||
this._workspaceCreateInput.textContent = '';
|
||||
this._workspaceCreateInput.value = '';
|
||||
this._workspaceCreateInput.setAttribute('data-initial-value', '');
|
||||
|
Reference in New Issue
Block a user