提交 80411d3f 编写于 作者: R Ryan Adolf

Make titlebar render correctly on reload

上级 233784d6
......@@ -299,12 +299,8 @@ export class TitlebarPart extends Part implements ITitleService {
this.windowService.closeWindow().then(null, errors.onUnexpectedError);
});
this.windowService.onDidChangeMaximize((maximized) => {
($(this.titleContainer).getHTMLElement().querySelector('.window-maximize') as SVGElement).style.display = maximized ? 'none' : 'inline';
($(this.titleContainer).getHTMLElement().querySelector('.window-unmaximize') as SVGElement).style.display = maximized ? 'inline' : 'none';
$(this.titleContainer).getHTMLElement().style.paddingLeft = maximized ? '0.15em' : '0.5em';
$(this.titleContainer).getHTMLElement().style.paddingRight = maximized ? 'calc(2em / 12)' : '0';
}, this);
this.windowService.isMaximized().then((max) => this.onDidChangeMaximized(max), errors.onUnexpectedError);
this.windowService.onDidChangeMaximize(this.onDidChangeMaximized, this);
}
// Since the title area is used to drag the window, we do not want to steal focus from the
......@@ -321,6 +317,13 @@ export class TitlebarPart extends Part implements ITitleService {
return this.titleContainer;
}
private onDidChangeMaximized(maximized: boolean) {
($(this.titleContainer).getHTMLElement().querySelector('.window-maximize') as SVGElement).style.display = maximized ? 'none' : 'inline';
($(this.titleContainer).getHTMLElement().querySelector('.window-unmaximize') as SVGElement).style.display = maximized ? 'inline' : 'none';
$(this.titleContainer).getHTMLElement().style.paddingLeft = maximized ? '0.15em' : '0.5em';
$(this.titleContainer).getHTMLElement().style.paddingRight = maximized ? 'calc(2em / 12)' : '0';
}
protected updateStyles(): void {
super.updateStyles();
......
......@@ -584,9 +584,6 @@ export class Workbench implements IPartService {
this.toDispose.push(this.titlebarPart);
this.toShutdown.push(this.titlebarPart);
serviceCollection.set(ITitleService, this.titlebarPart);
if (!isMacintosh && this.getCustomTitleBarStyle()) {
this.windowService.onDidChangeMaximize((max) => this.workbenchLayout.onMaximizeChange(max));
}
// History
serviceCollection.set(IHistoryService, new SyncDescriptor(HistoryService));
......@@ -1147,6 +1144,15 @@ export class Workbench implements IPartService {
this.quickOpen // Quickopen
);
if (!isMacintosh && this.getCustomTitleBarStyle()) {
this.windowService.isMaximized().then((max) => {
console.log(this);
this.workbenchLayout.onMaximizeChange(max);
this.workbenchLayout.layout();
});
this.windowService.onDidChangeMaximize(this.workbenchLayout.onMaximizeChange, this.workbenchLayout);
}
this.toDispose.push(this.workbenchLayout);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册