Refactor zen-glance animation and improve tab context handling

This commit is contained in:
mr. M
2025-02-01 11:32:32 +01:00
parent 2b17b5bd72
commit c47c140489
2 changed files with 17 additions and 15 deletions

View File

@@ -108,9 +108,7 @@
} }
&[animate-full='true'] { &[animate-full='true'] {
opacity: 1; transform: translate(-50%, -50%);
animation: zen-glance-buttons-animation-full 0.2s ease-in-out forwards !important;
& #zen-glance-sidebar-container { & #zen-glance-sidebar-container {
opacity: 0 !important; opacity: 0 !important;
} }

View File

@@ -67,7 +67,9 @@
}; };
this.currentParentTab = currentTab; this.currentParentTab = currentTab;
const newTab = existingTab ?? gBrowser.addTrustedTab(Services.io.newURI(url).spec, newTabOptions); const newTab = existingTab ?? gBrowser.addTrustedTab(Services.io.newURI(url).spec, newTabOptions);
if (currentTab.hasAttribute('zenDefaultUserContextId')) {
newTab.setAttribute('zenDefaultUserContextId', true);
}
gBrowser.selectedTab = newTab; gBrowser.selectedTab = newTab;
currentTab.querySelector('.tab-content').appendChild(newTab); currentTab.querySelector('.tab-content').appendChild(newTab);
newTab.setAttribute('zen-glance-tab', true); newTab.setAttribute('zen-glance-tab', true);
@@ -89,7 +91,6 @@
this.browserWrapper?.removeAttribute('animate'); this.browserWrapper?.removeAttribute('animate');
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('has-finished-animation'); this.browserWrapper?.removeAttribute('has-finished-animation');
this.overlay?.removeAttribute('post-fade-out'); this.overlay?.removeAttribute('post-fade-out');
@@ -363,16 +364,19 @@
this.#currentTab.removeAttribute('zen-glance-tab'); this.#currentTab.removeAttribute('zen-glance-tab');
gBrowser.selectedTab = this.#currentTab; gBrowser.selectedTab = this.#currentTab;
this.currentParentTab.linkedBrowser.closest('.browserSidebarContainer').classList.remove('zen-glance-background'); this.currentParentTab.linkedBrowser.closest('.browserSidebarContainer').classList.remove('zen-glance-background');
setTimeout(() => { gZenUIManager.motion.animate(this.browserWrapper, {
window.requestAnimationFrame(() => { width: ['85%', '100%'],
this.browserWrapper.setAttribute('animate-full-end', true); height: ['100%', '100%'],
this.overlay.classList.remove('zen-glance-overlay'); }, {
setTimeout(() => { duration: 0.4,
this.animatingFullOpen = false; type: 'spring',
this.closeGlance({ noAnimation: true }); }).then(() => {
}, 600); this.browserWrapper.removeAttribute('animate-full');
}); this.overlay.classList.remove('zen-glance-overlay');
}, 300); this.browserWrapper.removeAttribute('style');
this.animatingFullOpen = false;
this.closeGlance({ noAnimation: true });
});
} }
openGlanceForBookmark(event) { openGlanceForBookmark(event) {