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