mirror of
https://github.com/zen-browser/desktop.git
synced 2025-10-07 18:36:36 +00:00
Added right side compact mode animations
This commit is contained in:
@@ -37,7 +37,8 @@ var gZenCompactModeManager = {
|
|||||||
if (this._sidebarIsOnRight) {
|
if (this._sidebarIsOnRight) {
|
||||||
return this._sidebarIsOnRight;
|
return this._sidebarIsOnRight;
|
||||||
}
|
}
|
||||||
return Services.prefs.getBoolPref('zen.tabs.vertical.right-side');
|
this._sidebarIsOnRight = Services.prefs.getBoolPref('zen.tabs.vertical.right-side');
|
||||||
|
return this._sidebarIsOnRight;
|
||||||
},
|
},
|
||||||
|
|
||||||
get sidebar() {
|
get sidebar() {
|
||||||
@@ -104,10 +105,11 @@ var gZenCompactModeManager = {
|
|||||||
}
|
}
|
||||||
this._isAnimating = true;
|
this._isAnimating = true;
|
||||||
if (canHideSidebar && isCompactMode) {
|
if (canHideSidebar && isCompactMode) {
|
||||||
|
window.requestAnimationFrame(() => {
|
||||||
window.requestAnimationFrame(() => {
|
window.requestAnimationFrame(() => {
|
||||||
this.sidebar.style.position = "relative";
|
this.sidebar.style.position = "relative";
|
||||||
this.sidebar.style.transition = "margin-left .3s ease";
|
this.sidebar.style.transition = "margin-left .3s ease";
|
||||||
this.sidebar.style.marginLeft = `calc(-1 * ${this.sidebar.getAttribute("width")}px)`;
|
this.sidebar.style.marginLeft = `${(this.sidebarIsOnRight ? 1 : -1) * this.sidebar.getAttribute("width")}px`;
|
||||||
this.sidebar.style.pointerEvents = "none";
|
this.sidebar.style.pointerEvents = "none";
|
||||||
this.sidebar.style.opacity = "0";
|
this.sidebar.style.opacity = "0";
|
||||||
|
|
||||||
@@ -122,10 +124,12 @@ var gZenCompactModeManager = {
|
|||||||
});
|
});
|
||||||
}, 300);
|
}, 300);
|
||||||
});
|
});
|
||||||
|
});
|
||||||
} else if (canHideSidebar && !isCompactMode) {
|
} else if (canHideSidebar && !isCompactMode) {
|
||||||
// we are in compact mode and we are exiting it
|
// we are in compact mode and we are exiting it
|
||||||
this.sidebar.style.marginLeft = `calc(-1 * ${this.sidebar.getAttribute("width")}px)`;
|
this.sidebar.style.marginLeft = `${(this.sidebarIsOnRight ? 1 : -1) * this.sidebar.getAttribute("width")}px`;
|
||||||
|
|
||||||
|
window.requestAnimationFrame(() => {
|
||||||
window.requestAnimationFrame(() => {
|
window.requestAnimationFrame(() => {
|
||||||
this.sidebar.style.position = "relative";
|
this.sidebar.style.position = "relative";
|
||||||
this.sidebar.style.transition = "margin-left .3s ease";
|
this.sidebar.style.transition = "margin-left .3s ease";
|
||||||
@@ -142,6 +146,7 @@ var gZenCompactModeManager = {
|
|||||||
});
|
});
|
||||||
}, 300);
|
}, 300);
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user