Move mouse wheel fix out of patch

This commit is contained in:
Asher 2019-02-01 12:32:42 -06:00 committed by Kyle Carberry
parent d677a2ee37
commit b40722869e
No known key found for this signature in database
GPG Key ID: A0409BDB6B0B3EDB
3 changed files with 20 additions and 29 deletions

View File

@ -6,6 +6,7 @@ import "./fill/windowsService";
import "./fill/environmentService";
import "./fill/vscodeTextmate";
import "./fill/codeEditor";
import "./fill/mouseEvent";
import { PasteAction } from "./fill/paste";
import "./fill/dom";
import "./vscode.scss";

View File

@ -0,0 +1,19 @@
import * as mouse from "vs/base/browser/mouseEvent";
/**
* Fix the wheel event for Firefox.
*/
class StandardWheelEvent extends mouse.StandardWheelEvent {
public constructor(event: mouse.IMouseWheelEvent | null) {
super(
event,
(-(event as any as MouseWheelEvent).deltaX || 0) / 3, // tslint:disable-line no-any
(-(event as any as MouseWheelEvent).deltaY || 0) / 3, // tslint:disable-line no-any
);
}
}
const target = mouse as typeof mouse;
target.StandardWheelEvent = StandardWheelEvent;

View File

@ -1,32 +1,3 @@
diff --git a/src/vs/base/browser/mouseEvent.ts b/src/vs/base/browser/mouseEvent.ts
index 89ff65ec49..bc0cf2b08c 100644
--- a/src/vs/base/browser/mouseEvent.ts
+++ b/src/vs/base/browser/mouseEvent.ts
@@ -147,12 +147,15 @@ export class StandardWheelEvent {
if (e) {
let e1 = <IWebKitMouseWheelEvent><any>e;
let e2 = <IGeckoMouseWheelEvent><any>e;
+ let e3 = <MouseWheelEvent><any>e;
// vertical delta scroll
if (typeof e1.wheelDeltaY !== 'undefined') {
this.deltaY = e1.wheelDeltaY / 120;
} else if (typeof e2.VERTICAL_AXIS !== 'undefined' && e2.axis === e2.VERTICAL_AXIS) {
this.deltaY = -e2.detail / 3;
+ } else if (typeof e3.deltaY !== "undefined") {
+ this.deltaY = -e3.deltaY / 3;
}
// horizontal delta scroll
@@ -164,6 +167,8 @@ export class StandardWheelEvent {
}
} else if (typeof e2.HORIZONTAL_AXIS !== 'undefined' && e2.axis === e2.HORIZONTAL_AXIS) {
this.deltaX = -e.detail / 3;
+ } else if (typeof e3.deltaX !== "undefined") {
+ this.deltaX = -e3.deltaX / 3;
}
// Assume a vertical scroll if nothing else worked
diff --git a/src/vs/base/browser/ui/scrollbar/scrollableElement.ts b/src/vs/base/browser/ui/scrollbar/scrollableElement.ts
index a6256deeba..69819e0f3a 100644
--- a/src/vs/base/browser/ui/scrollbar/scrollableElement.ts