提交 1bd78fbf 编写于 作者: A Alex Dima

Fixes #8282: Guard editor zooming with `editor.mouseWheelZoom` that is off by...

Fixes #8282: Guard editor zooming with `editor.mouseWheelZoom` that is off by default until we implement a better story
上级 681e42f8
......@@ -167,6 +167,9 @@ export class MouseHandler extends ViewEventHandler implements IDisposable {
this.listenersToRemove.push(mouseEvents.onMouseDown(this.viewHelper.viewDomNode, (e) => this._onMouseDown(e)));
let onMouseWheel = (browserEvent: MouseWheelEvent) => {
if (!this._context.configuration.editor.viewInfo.mouseWheelZoom) {
return;
}
let e = new StandardMouseWheelEvent(browserEvent);
if (e.browserEvent.ctrlKey) {
let zoomLevel:number = EditorZoom.getZoomLevel();
......
......@@ -195,6 +195,7 @@ class InternalEditorOptionsHelper {
roundedSelection: toBoolean(opts.roundedSelection),
overviewRulerLanes: toInteger(opts.overviewRulerLanes, 0, 3),
cursorBlinking: opts.cursorBlinking,
mouseWheelZoom: toBoolean(opts.mouseWheelZoom),
cursorStyle: cursorStyleFromString(opts.cursorStyle),
hideCursorInOverviewRuler: toBoolean(opts.hideCursorInOverviewRuler),
scrollBeyondLastLine: toBoolean(opts.scrollBeyondLastLine),
......@@ -671,6 +672,11 @@ let editorConfiguration:IConfigurationNode = {
'default': DefaultConfig.editor.cursorBlinking,
'description': nls.localize('cursorBlinking', "Controls the cursor blinking animation, accepted values are 'blink', 'visible', and 'hidden'")
},
'editor.mouseWheelZoom': {
'type': 'boolean',
'default': DefaultConfig.editor.mouseWheelZoom,
'description': nls.localize('mouseWheelZoom', "Zoom the font of the editor when using mouse wheel and holding Ctrl")
},
'editor.cursorStyle' : {
'type': 'string',
'enum': ['block', 'line'],
......
......@@ -58,6 +58,7 @@ class ConfigClass implements IConfiguration {
},
overviewRulerLanes: 2,
cursorBlinking: 'blink',
mouseWheelZoom: false,
cursorStyle: 'line',
fontLigatures: false,
disableTranslate3d: false,
......
......@@ -263,6 +263,11 @@ export interface IEditorOptions {
* Defaults to 'blink'.
*/
cursorBlinking?:string;
/**
* Zoom the font in the editor when using the mouse wheel in combination with holding Ctrl.
* Defaults to false.
*/
mouseWheelZoom?: boolean;
/**
* Control the cursor style, either 'block' or 'line'.
* Defaults to 'line'.
......@@ -611,6 +616,7 @@ export class InternalEditorViewOptions {
roundedSelection:boolean;
overviewRulerLanes:number;
cursorBlinking:string;
mouseWheelZoom:boolean;
cursorStyle:TextEditorCursorStyle;
hideCursorInOverviewRuler:boolean;
scrollBeyondLastLine:boolean;
......@@ -637,6 +643,7 @@ export class InternalEditorViewOptions {
roundedSelection:boolean;
overviewRulerLanes:number;
cursorBlinking:string;
mouseWheelZoom:boolean;
cursorStyle:TextEditorCursorStyle;
hideCursorInOverviewRuler:boolean;
scrollBeyondLastLine:boolean;
......@@ -659,6 +666,7 @@ export class InternalEditorViewOptions {
this.roundedSelection = Boolean(source.roundedSelection);
this.overviewRulerLanes = source.overviewRulerLanes|0;
this.cursorBlinking = String(source.cursorBlinking);
this.mouseWheelZoom = Boolean(source.mouseWheelZoom);
this.cursorStyle = source.cursorStyle|0;
this.hideCursorInOverviewRuler = Boolean(source.hideCursorInOverviewRuler);
this.scrollBeyondLastLine = Boolean(source.scrollBeyondLastLine);
......@@ -715,6 +723,7 @@ export class InternalEditorViewOptions {
&& this.roundedSelection === other.roundedSelection
&& this.overviewRulerLanes === other.overviewRulerLanes
&& this.cursorBlinking === other.cursorBlinking
&& this.mouseWheelZoom === other.mouseWheelZoom
&& this.cursorStyle === other.cursorStyle
&& this.hideCursorInOverviewRuler === other.hideCursorInOverviewRuler
&& this.scrollBeyondLastLine === other.scrollBeyondLastLine
......@@ -744,6 +753,7 @@ export class InternalEditorViewOptions {
roundedSelection: this.roundedSelection !== newOpts.roundedSelection,
overviewRulerLanes: this.overviewRulerLanes !== newOpts.overviewRulerLanes,
cursorBlinking: this.cursorBlinking !== newOpts.cursorBlinking,
mouseWheelZoom: this.mouseWheelZoom !== newOpts.mouseWheelZoom,
cursorStyle: this.cursorStyle !== newOpts.cursorStyle,
hideCursorInOverviewRuler: this.hideCursorInOverviewRuler !== newOpts.hideCursorInOverviewRuler,
scrollBeyondLastLine: this.scrollBeyondLastLine !== newOpts.scrollBeyondLastLine,
......@@ -777,6 +787,7 @@ export interface IViewConfigurationChangedEvent {
roundedSelection: boolean;
overviewRulerLanes: boolean;
cursorBlinking: boolean;
mouseWheelZoom: boolean;
cursorStyle: boolean;
hideCursorInOverviewRuler: boolean;
scrollBeyondLastLine: boolean;
......
......@@ -1117,6 +1117,11 @@ declare module monaco.editor {
* Defaults to 'blink'.
*/
cursorBlinking?: string;
/**
* Zoom the font in the editor when using the mouse wheel in combination with holding Ctrl.
* Defaults to false.
*/
mouseWheelZoom?: boolean;
/**
* Control the cursor style, either 'block' or 'line'.
* Defaults to 'line'.
......@@ -1362,6 +1367,7 @@ declare module monaco.editor {
roundedSelection: boolean;
overviewRulerLanes: number;
cursorBlinking: string;
mouseWheelZoom: boolean;
cursorStyle: TextEditorCursorStyle;
hideCursorInOverviewRuler: boolean;
scrollBeyondLastLine: boolean;
......@@ -1386,6 +1392,7 @@ declare module monaco.editor {
roundedSelection: boolean;
overviewRulerLanes: boolean;
cursorBlinking: boolean;
mouseWheelZoom: boolean;
cursorStyle: boolean;
hideCursorInOverviewRuler: boolean;
scrollBeyondLastLine: boolean;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册