mirror of
https://github.com/zen-browser/desktop.git
synced 2025-10-16 14:56:14 +00:00
Refactor sidebar width calculation in compact mode and update toolbar separator logic
This commit is contained in:
@@ -544,7 +544,7 @@ var gZenVerticalTabsManager = {
|
|||||||
);
|
);
|
||||||
elements = Array.from(elements).reverse();
|
elements = Array.from(elements).reverse();
|
||||||
// Add separator if it doesn't exist
|
// Add separator if it doesn't exist
|
||||||
if (!buttonsTarget.contains(this._topButtonsSeparatorElement)) {
|
if (!this._hasSetSingleToolbar) {
|
||||||
buttonsTarget.append(this._topButtonsSeparatorElement);
|
buttonsTarget.append(this._topButtonsSeparatorElement);
|
||||||
}
|
}
|
||||||
for (const button of elements) {
|
for (const button of elements) {
|
||||||
|
@@ -116,9 +116,8 @@
|
|||||||
outline-offset: -1px;
|
outline-offset: -1px;
|
||||||
min-width: var(--zen-toolbox-min-width);
|
min-width: var(--zen-toolbox-min-width);
|
||||||
|
|
||||||
/* times 4 because we have the inner padding and the outter padding to consider */
|
|
||||||
:root[zen-sidebar-expanded='true'] & {
|
:root[zen-sidebar-expanded='true'] & {
|
||||||
width: calc(var(--zen-sidebar-width) - var(--zen-toolbox-padding));
|
width: var(--zen-sidebar-width);
|
||||||
}
|
}
|
||||||
|
|
||||||
:root[zen-single-toolbar='true'] {
|
:root[zen-single-toolbar='true'] {
|
||||||
|
@@ -220,10 +220,12 @@ var gZenCompactModeManager = {
|
|||||||
}
|
}
|
||||||
if (canHideSidebar && isCompactMode) {
|
if (canHideSidebar && isCompactMode) {
|
||||||
const elementSeparation = ZenThemeModifier.elementSeparation;
|
const elementSeparation = ZenThemeModifier.elementSeparation;
|
||||||
sidebarWidth -= 0.5 * splitterWidth;
|
if (document.documentElement.hasAttribute('zen-sidebar-expanded')) {
|
||||||
if (elementSeparation < splitterWidth) {
|
sidebarWidth -= 0.5 * splitterWidth;
|
||||||
// Subtract from the splitter width to end up with the correct element separation
|
if (elementSeparation < splitterWidth) {
|
||||||
sidebarWidth += 1.5 * splitterWidth - elementSeparation;
|
// Subtract from the splitter width to end up with the correct element separation
|
||||||
|
sidebarWidth += 1.5 * splitterWidth - elementSeparation;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
gZenUIManager.motion
|
gZenUIManager.motion
|
||||||
.animate(
|
.animate(
|
||||||
@@ -242,7 +244,6 @@ var gZenCompactModeManager = {
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
this.sidebar.style.transition = 'none';
|
this.sidebar.style.transition = 'none';
|
||||||
this.sidebar.style.opacity = 0;
|
this.sidebar.style.opacity = 0;
|
||||||
this.getAndApplySidebarWidth();
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.sidebar.removeAttribute('animate');
|
this.sidebar.removeAttribute('animate');
|
||||||
document.documentElement.removeAttribute('zen-compact-animating');
|
document.documentElement.removeAttribute('zen-compact-animating');
|
||||||
|
Reference in New Issue
Block a user