提交 ebffc011 编写于 作者: I isidor

zen mode: do not update on settings change

fixes #16597
上级 696e5872
...@@ -179,7 +179,8 @@ export class Workbench implements IPartService { ...@@ -179,7 +179,8 @@ export class Workbench implements IPartService {
private zenMode: { private zenMode: {
active: boolean; active: boolean;
transitionedToFullScreen: boolean; transitionedToFullScreen: boolean;
wasPartVisible: { [part: string]: boolean }; wasSideBarVisible: boolean;
wasPanelVisible: boolean;
}; };
constructor( constructor(
...@@ -540,8 +541,9 @@ export class Workbench implements IPartService { ...@@ -540,8 +541,9 @@ export class Workbench implements IPartService {
// Zen mode // Zen mode
this.zenMode = { this.zenMode = {
active: false, active: false,
wasPartVisible: {}, transitionedToFullScreen: false,
transitionedToFullScreen: false wasSideBarVisible: false,
wasPanelVisible: false
}; };
} }
...@@ -862,21 +864,23 @@ export class Workbench implements IPartService { ...@@ -862,21 +864,23 @@ export class Workbench implements IPartService {
} }
} }
private onDidUpdateConfiguration(): void { private onDidUpdateConfiguration(skipLayout?: boolean): void {
const newSidebarPositionValue = this.configurationService.lookup<string>(Workbench.sidebarPositionConfigurationKey).value; const newSidebarPositionValue = this.configurationService.lookup<string>(Workbench.sidebarPositionConfigurationKey).value;
const newSidebarPosition = (newSidebarPositionValue === 'right') ? Position.RIGHT : Position.LEFT; const newSidebarPosition = (newSidebarPositionValue === 'right') ? Position.RIGHT : Position.LEFT;
if (newSidebarPosition !== this.getSideBarPosition()) { if (newSidebarPosition !== this.getSideBarPosition()) {
this.setSideBarPosition(newSidebarPosition); this.setSideBarPosition(newSidebarPosition);
} }
const newStatusbarHiddenValue = !this.configurationService.lookup<boolean>(Workbench.statusbarVisibleConfigurationKey).value; if (!this.zenMode.active) {
if (newStatusbarHiddenValue !== this.statusBarHidden) { const newStatusbarHiddenValue = !this.configurationService.lookup<boolean>(Workbench.statusbarVisibleConfigurationKey).value;
this.setStatusBarHidden(newStatusbarHiddenValue); if (newStatusbarHiddenValue !== this.statusBarHidden) {
} this.setStatusBarHidden(newStatusbarHiddenValue, skipLayout);
}
const newActivityBarHiddenValue = !this.configurationService.lookup<boolean>(Workbench.activityBarVisibleConfigurationKey).value; const newActivityBarHiddenValue = !this.configurationService.lookup<boolean>(Workbench.activityBarVisibleConfigurationKey).value;
if (newActivityBarHiddenValue !== this.activityBarHidden) { if (newActivityBarHiddenValue !== this.activityBarHidden) {
this.setActivityBarHidden(newActivityBarHiddenValue); this.setActivityBarHidden(newActivityBarHiddenValue, skipLayout);
}
} }
} }
...@@ -1055,29 +1059,21 @@ export class Workbench implements IPartService { ...@@ -1055,29 +1059,21 @@ export class Workbench implements IPartService {
const windowConfig = this.configurationService.getConfiguration<IWindowConfiguration>(); const windowConfig = this.configurationService.getConfiguration<IWindowConfiguration>();
toggleFullScreen = !browser.isFullscreen() && windowConfig.window.fullScreenZenMode; toggleFullScreen = !browser.isFullscreen() && windowConfig.window.fullScreenZenMode;
this.zenMode.transitionedToFullScreen = toggleFullScreen; this.zenMode.transitionedToFullScreen = toggleFullScreen;
const rememberPartsVisible = (part: Parts) => this.zenMode.wasPartVisible[part] = this.isVisible(part); this.zenMode.wasSideBarVisible = this.isVisible(Parts.SIDEBAR_PART);
rememberPartsVisible(Parts.ACTIVITYBAR_PART); this.zenMode.wasPanelVisible = this.isVisible(Parts.PANEL_PART);
rememberPartsVisible(Parts.PANEL_PART);
rememberPartsVisible(Parts.SIDEBAR_PART);
rememberPartsVisible(Parts.STATUSBAR_PART);
this.setActivityBarHidden(true, true);
this.setPanelHidden(true, true); this.setPanelHidden(true, true);
this.setSideBarHidden(true, true); this.setSideBarHidden(true, true);
this.setActivityBarHidden(true, true);
this.setStatusBarHidden(true, true); this.setStatusBarHidden(true, true);
} else { } else {
if (this.zenMode.wasPartVisible[Parts.ACTIVITYBAR_PART]) { if (this.zenMode.wasPanelVisible) {
this.setActivityBarHidden(false, true);
}
if (this.zenMode.wasPartVisible[Parts.PANEL_PART]) {
this.setPanelHidden(false, true); this.setPanelHidden(false, true);
} }
if (this.zenMode.wasPartVisible[Parts.SIDEBAR_PART]) { if (this.zenMode.wasSideBarVisible) {
this.setSideBarHidden(false, true); this.setSideBarHidden(false, true);
} }
if (this.zenMode.wasPartVisible[Parts.STATUSBAR_PART]) { // Status bar and activity bar visibility come from settings -> update their visibility.
this.setStatusBarHidden(false, true); this.onDidUpdateConfiguration(true);
}
this.zenMode.wasPartVisible = {};
toggleFullScreen = this.zenMode.transitionedToFullScreen && browser.isFullscreen(); toggleFullScreen = this.zenMode.transitionedToFullScreen && browser.isFullscreen();
} }
this.inZenMode.set(this.zenMode.active); this.inZenMode.set(this.zenMode.active);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册