mirror of
https://github.com/zen-browser/desktop.git
synced 2025-10-16 14:56:14 +00:00
Avoid sidebar width re-caclulation when animating compact mode
This commit is contained in:
@@ -159,6 +159,10 @@ var gZenCompactModeManager = {
|
||||
// NOTE: Dont actually use event, it's just so we make sure
|
||||
// the caller is from the ResizeObserver
|
||||
getAndApplySidebarWidth(event = undefined) {
|
||||
if (this._ignoreNextResize) {
|
||||
this._ignoreNextResize = false;
|
||||
return;
|
||||
}
|
||||
let sidebarWidth = this.sidebar.getBoundingClientRect().width;
|
||||
if (sidebarWidth > 1) {
|
||||
gZenUIManager.restoreScrollbarState();
|
||||
@@ -235,17 +239,14 @@ var gZenCompactModeManager = {
|
||||
setTimeout(() => {
|
||||
this.sidebar.removeAttribute('animate');
|
||||
document.documentElement.removeAttribute('zen-compact-animating');
|
||||
|
||||
this.getAndApplySidebarWidth({});
|
||||
this._ignoreNextResize = true;
|
||||
|
||||
this.sidebar.style.removeProperty('margin-right');
|
||||
this.sidebar.style.removeProperty('margin-left');
|
||||
this.sidebar.style.removeProperty('opacity');
|
||||
|
||||
setTimeout(() => {
|
||||
this.sidebar.style.removeProperty('transition');
|
||||
|
||||
// Just in case:
|
||||
this.sidebar.style.removeProperty('margin-right');
|
||||
this.sidebar.style.removeProperty('margin-left');
|
||||
}, 200);
|
||||
this.sidebar.style.removeProperty('transition');
|
||||
|
||||
resolve();
|
||||
}, 0);
|
||||
|
Reference in New Issue
Block a user