Skip to content

Commit a2ecf38

Browse files
authored
move banner above title bar in web (microsoft#163492)
* move banner above title bar in web * bug fixes, testing PWA
1 parent 6684350 commit a2ecf38

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

src/vs/workbench/browser/layout.ts

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,13 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
161161
get offset() {
162162
let top = 0;
163163
let quickPickTop = 0;
164+
if (this.isVisible(Parts.BANNER_PART)) {
165+
top = this.getPart(Parts.BANNER_PART).maximumHeight;
166+
quickPickTop = top;
167+
}
164168
if (this.isVisible(Parts.TITLEBAR_PART)) {
165-
top = this.getPart(Parts.TITLEBAR_PART).maximumHeight;
166-
quickPickTop = this.titleService.isCommandCenterVisible ? 0 : top;
169+
top += this.getPart(Parts.TITLEBAR_PART).maximumHeight;
170+
quickPickTop = this.titleService.isCommandCenterVisible ? quickPickTop : top;
167171
}
168172
return { top, quickPickTop };
169173
}
@@ -1019,6 +1023,8 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
10191023
return !this.stateModel.getRuntimeValue(LayoutStateKeys.ACTIVITYBAR_HIDDEN);
10201024
case Parts.EDITOR_PART:
10211025
return !this.stateModel.getRuntimeValue(LayoutStateKeys.EDITOR_HIDDEN);
1026+
case Parts.BANNER_PART:
1027+
return this.workbenchGrid.isViewVisible(this.bannerPartView);
10221028
default:
10231029
return false; // any other part cannot be hidden
10241030
}
@@ -1301,7 +1307,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
13011307
this.workbenchGrid = workbenchGrid;
13021308
this.workbenchGrid.edgeSnapping = this.state.runtime.fullscreen;
13031309

1304-
for (const part of [titleBar, editorPart, activityBar, panelPart, sideBar, statusBar, auxiliaryBarPart]) {
1310+
for (const part of [titleBar, editorPart, activityBar, panelPart, sideBar, statusBar, auxiliaryBarPart, bannerPart]) {
13051311
this._register(part.onDidVisibilityChange((visible) => {
13061312
if (part === sideBar) {
13071313
this.setSideBarHidden(!visible, true);
@@ -2096,6 +2102,21 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
20962102
const activityBarWidth = this.activityBarPartView.minimumWidth;
20972103
const middleSectionHeight = height - titleBarHeight - statusBarHeight;
20982104

2105+
const titleAndBanner: ISerializedNode[] = [
2106+
{
2107+
type: 'leaf',
2108+
data: { type: Parts.TITLEBAR_PART },
2109+
size: titleBarHeight,
2110+
visible: this.isVisible(Parts.TITLEBAR_PART)
2111+
},
2112+
{
2113+
type: 'leaf',
2114+
data: { type: Parts.BANNER_PART },
2115+
size: bannerHeight,
2116+
visible: false
2117+
}
2118+
];
2119+
20992120
const activityBarNode: ISerializedLeafNode = {
21002121
type: 'leaf',
21012122
data: { type: Parts.ACTIVITYBAR_PART },
@@ -2145,18 +2166,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
21452166
type: 'branch',
21462167
size: width,
21472168
data: [
2148-
{
2149-
type: 'leaf',
2150-
data: { type: Parts.TITLEBAR_PART },
2151-
size: titleBarHeight,
2152-
visible: this.isVisible(Parts.TITLEBAR_PART)
2153-
},
2154-
{
2155-
type: 'leaf',
2156-
data: { type: Parts.BANNER_PART },
2157-
size: bannerHeight,
2158-
visible: false
2159-
},
2169+
...(isWeb ? titleAndBanner.reverse() : titleAndBanner),
21602170
{
21612171
type: 'branch',
21622172
data: middleSection,

0 commit comments

Comments
 (0)