Skip to content

Commit cd003c2

Browse files
authored
fix: double account for DPR in mouse wheel classifier (microsoft#203513)
1 parent fb5a1ac commit cd003c2

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/vs/base/browser/ui/scrollbar/scrollableElement.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { getZoomFactor } from 'vs/base/browser/browser';
6+
import { getZoomFactor, isChrome } from 'vs/base/browser/browser';
77
import * as dom from 'vs/base/browser/dom';
88
import { createFastDomNode, FastDomNode } from 'vs/base/browser/fastDomNode';
99
import { IMouseEvent, IMouseWheelEvent, StandardWheelEvent } from 'vs/base/browser/mouseEvent';
@@ -87,12 +87,12 @@ export class MouseWheelClassifier {
8787
}
8888

8989
public acceptStandardWheelEvent(e: StandardWheelEvent): void {
90-
const targetWindow = dom.getWindow(e.browserEvent);
91-
const osZoomFactor = targetWindow.devicePixelRatio / getZoomFactor(targetWindow);
92-
if (platform.isWindows || platform.isLinux) {
93-
// On Windows and Linux, the incoming delta events are multiplied with the OS zoom factor.
90+
if (isChrome) {
91+
const targetWindow = dom.getWindow(e.browserEvent);
92+
const pageZoomFactor = getZoomFactor(targetWindow);
93+
// On Chrome, the incoming delta events are multiplied with the OS zoom factor.
9494
// The OS zoom factor can be reverse engineered by using the device pixel ratio and the configured zoom factor into account.
95-
this.accept(Date.now(), e.deltaX / osZoomFactor, e.deltaY / osZoomFactor);
95+
this.accept(Date.now(), e.deltaX * pageZoomFactor, e.deltaY * pageZoomFactor);
9696
} else {
9797
this.accept(Date.now(), e.deltaX, e.deltaY);
9898
}

0 commit comments

Comments
 (0)