Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: double account for DPR in mouse wheel classifier #203530

Merged
merged 1 commit into from
Jan 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/vs/base/browser/ui/scrollbar/scrollableElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { getZoomFactor } from 'vs/base/browser/browser';
import { getZoomFactor, isChrome } from 'vs/base/browser/browser';
import * as dom from 'vs/base/browser/dom';
import { createFastDomNode, FastDomNode } from 'vs/base/browser/fastDomNode';
import { IMouseEvent, IMouseWheelEvent, StandardWheelEvent } from 'vs/base/browser/mouseEvent';
Expand Down Expand Up @@ -87,12 +87,12 @@ export class MouseWheelClassifier {
}

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