Skip to content

Commit 00b132d

Browse files
committed
fix: Fixed compact mode animation toggle not taking the actual separator width, b=no-bug, c=compact-mode
1 parent 32aff66 commit 00b132d

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

src/zen/compact-mode/ZenCompactMode.mjs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,11 +359,47 @@
359359
) {
360360
return;
361361
}
362+
<<<<<<< Updated upstream
362363
delete gZenVerticalTabsManager._hadSidebarCollapse;
363364
this.sidebar.style.setProperty('--zen-sidebar-width', `${sidebarWidth}px`);
364365
}
365366
return sidebarWidth;
366367
},
368+
=======
369+
if (document.documentElement.hasAttribute('zen-sidebar-expanded')) {
370+
sidebarWidth -= 0.5 * splitterWidth;
371+
if (elementSeparation < splitterWidth) {
372+
// Subtract from the splitter width to end up with the correct element separation
373+
sidebarWidth += 1.5 * splitterWidth - elementSeparation;
374+
}
375+
} else {
376+
sidebarWidth -= elementSeparation;
377+
}
378+
if (canHideSidebar && isCompactMode) {
379+
this._setElementExpandAttribute(this.sidebar, false);
380+
gZenUIManager.motion
381+
.animate(
382+
this.sidebar,
383+
{
384+
marginRight: [0, this.sidebarIsOnRight ? `-${sidebarWidth}px` : 0],
385+
marginLeft: [0, this.sidebarIsOnRight ? 0 : `-${sidebarWidth}px`],
386+
},
387+
{
388+
ease: 'easeIn',
389+
type: 'spring',
390+
bounce: 0,
391+
duration: 0.12,
392+
}
393+
)
394+
.then(() => {
395+
this.sidebar.style.transition = 'none';
396+
this.sidebar.style.pointEvents = 'none';
397+
const titlebar = document.getElementById('titlebar');
398+
titlebar.style.visibility = 'hidden';
399+
titlebar.style.transition = 'none';
400+
this.sidebar.removeAttribute('animate');
401+
document.documentElement.removeAttribute('zen-compact-animating');
402+
>>>>>>> Stashed changes
367403

368404
get canHideSidebar() {
369405
return (

0 commit comments

Comments
 (0)