提交 158be751 编写于 作者: B Benjamin Pasero

cleanup zoomlevel configuration

上级 fe88d384
......@@ -123,12 +123,14 @@
};
}
// disable pinch zoom
// disable pinch zoom & apply zoom level early to avoid glitches
var windowConfiguration = globalSettings.settings && globalSettings.settings.window;
webFrame.setZoomLevelLimits(1, 1);
if (windowConfiguration && typeof windowConfiguration.zoomLevel === 'number' && windowConfiguration.zoomLevel !== 0) {
webFrame.setZoomLevel(windowConfiguration.zoomLevel);
}
// apply zoom level very early to avoid glitches
webFrame.setZoomLevel(globalSettings.settings.window.zoomLevel);
// Load the loader and start loading the workbench
var rootUrl = uriFromPath(configuration.appRoot) + '/out';
createScript(rootUrl + '/vs/loader.js', function() {
require.config({
......
......@@ -17,6 +17,7 @@ import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybindingService';
import {IWorkspaceContextService}from 'vs/workbench/services/workspace/common/contextService';
import {IWindowService}from 'vs/workbench/services/window/electron-browser/windowService';
import {IWindowConfiguration} from 'vs/workbench/electron-browser/window';
import {IConfigurationService, IConfigurationServiceEvent, ConfigurationServiceEventTypes} from 'vs/platform/configuration/common/configuration';
import win = require('vs/workbench/electron-browser/window');
......@@ -103,8 +104,16 @@ export class ElectronIntegration {
// Configuration changes
this.configurationService.addListener(ConfigurationServiceEventTypes.UPDATED, (e: IConfigurationServiceEvent) => {
let zoomLevel = e.config && e.config.window && e.config.window.zoomLevel;
webFrame.setZoomLevel(zoomLevel);
let windowConfig: IWindowConfiguration = e.config;
let newZoomLevel = 0;
if (windowConfig.window && typeof windowConfig.window.zoomLevel === 'number') {
newZoomLevel = windowConfig.window.zoomLevel;
}
if (webFrame.getZoomLevel() !== newZoomLevel) {
webFrame.setZoomLevel(newZoomLevel);
}
});
}
......
......@@ -60,8 +60,8 @@ configurationRegistry.registerConfiguration({
},
'window.zoomLevel': {
'type': 'number',
'default': '0',
'description': nls.localize('zoomLevel', "Zoom level todo")
'default': 0,
'description': nls.localize('zoomLevel', "Adjust the zoom level of the window. The original size is 0 and each increment above or below represents zooming 20% larger or smaller.")
}
}
});
......
......@@ -26,6 +26,14 @@ import ipc = require('ipc');
const Shell = remote.require('shell');
const Dialog = remote.require('dialog');
export interface IWindowConfiguration {
window: {
openFilesInNewWindow: boolean;
reopenFolders: string;
zoomLevel: number;
}
}
export class ElectronWindow {
private win: remote.BrowserWindow;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册