Skip to content

Commit 185d71b

Browse files
committed
Fixes microsoft/monaco-editor#211: Consume all mouse wheel events by default
1 parent 9daf238 commit 185d71b

4 files changed

Lines changed: 13 additions & 2 deletions

File tree

src/vs/editor/browser/viewParts/editorScrollbar/editorScrollbar.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export class EditorScrollbar extends ViewPart {
5050
horizontalScrollbarSize: scrollbar.horizontalScrollbarSize,
5151
horizontalSliderSize: scrollbar.horizontalSliderSize,
5252
handleMouseWheel: scrollbar.handleMouseWheel,
53+
alwaysConsumeMouseWheel: scrollbar.alwaysConsumeMouseWheel,
5354
arrowSize: scrollbar.arrowSize,
5455
mouseWheelScrollSensitivity: mouseWheelScrollSensitivity,
5556
fastScrollSensitivity: fastScrollSensitivity,

src/vs/editor/common/config/editorOptions.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2321,6 +2321,11 @@ export interface IEditorScrollbarOptions {
23212321
* Defaults to true.
23222322
*/
23232323
handleMouseWheel?: boolean;
2324+
/**
2325+
* Always consume mouse wheel events (always call preventDefault() and stopPropagation() on the browser events).
2326+
* Defaults to true.
2327+
*/
2328+
alwaysConsumeMouseWheel?: boolean;
23242329
/**
23252330
* Height in pixels for the horizontal scrollbar.
23262331
* Defaults to 10 (px).
@@ -2351,6 +2356,7 @@ export interface InternalEditorScrollbarOptions {
23512356
readonly verticalHasArrows: boolean;
23522357
readonly horizontalHasArrows: boolean;
23532358
readonly handleMouseWheel: boolean;
2359+
readonly alwaysConsumeMouseWheel: boolean;
23542360
readonly horizontalScrollbarSize: number;
23552361
readonly horizontalSliderSize: number;
23562362
readonly verticalScrollbarSize: number;
@@ -2385,6 +2391,7 @@ class EditorScrollbar extends BaseEditorOption<EditorOption.scrollbar, InternalE
23852391
verticalScrollbarSize: 14,
23862392
verticalSliderSize: 14,
23872393
handleMouseWheel: true,
2394+
alwaysConsumeMouseWheel: true
23882395
}
23892396
);
23902397
}
@@ -2404,6 +2411,7 @@ class EditorScrollbar extends BaseEditorOption<EditorOption.scrollbar, InternalE
24042411
verticalHasArrows: EditorBooleanOption.boolean(input.verticalHasArrows, this.defaultValue.verticalHasArrows),
24052412
horizontalHasArrows: EditorBooleanOption.boolean(input.horizontalHasArrows, this.defaultValue.horizontalHasArrows),
24062413
handleMouseWheel: EditorBooleanOption.boolean(input.handleMouseWheel, this.defaultValue.handleMouseWheel),
2414+
alwaysConsumeMouseWheel: EditorBooleanOption.boolean(input.alwaysConsumeMouseWheel, this.defaultValue.alwaysConsumeMouseWheel),
24072415
horizontalScrollbarSize: horizontalScrollbarSize,
24082416
horizontalSliderSize: EditorIntOption.clampedInt(input.horizontalSliderSize, horizontalScrollbarSize, 0, 1000),
24092417
verticalScrollbarSize: verticalScrollbarSize,

src/vs/editor/contrib/gotoSymbol/peek/referencesWidget.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,8 @@ export class ReferenceWidget extends peekView.PeekViewWidget {
291291
horizontal: 'auto',
292292
useShadows: true,
293293
verticalHasArrows: false,
294-
horizontalHasArrows: false
294+
horizontalHasArrows: false,
295+
alwaysConsumeMouseWheel: false
295296
},
296297
overviewRulerLanes: 2,
297298
fixedOverflowWidgets: true,

src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,8 @@ export class CallHierarchyTreePeekWidget extends peekView.PeekViewWidget {
175175
horizontal: 'auto',
176176
useShadows: true,
177177
verticalHasArrows: false,
178-
horizontalHasArrows: false
178+
horizontalHasArrows: false,
179+
alwaysConsumeMouseWheel: false
179180
},
180181
overviewRulerLanes: 2,
181182
fixedOverflowWidgets: true,

0 commit comments

Comments
 (0)