Skip to content

Commit e1e6c5d

Browse files
authored
Fix microsoft#202598. Handle browser detection correctly in notebook webview preload (microsoft#202599)
1 parent fee9ef2 commit e1e6c5d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import type { IDisposable } from 'vs/base/common/lifecycle';
99
import type * as webviewMessages from 'vs/workbench/contrib/notebook/browser/view/renderers/webviewMessages';
1010
import type { NotebookCellMetadata } from 'vs/workbench/contrib/notebook/common/notebookCommon';
1111
import type * as rendererApi from 'vscode-notebook-renderer';
12-
import * as browser from 'vs/base/browser/browser';
1312

1413
// !! IMPORTANT !! ----------------------------------------------------------------------------------
1514
// import { RenderOutputType } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
@@ -92,6 +91,8 @@ declare function __import(path: string): Promise<any>;
9291
async function webviewPreloads(ctx: PreloadContext) {
9392
// eslint-disable-next-line no-restricted-globals
9493
const $window = window as typeof DOM.$window;
94+
const userAgent = navigator.userAgent;
95+
const isChrome = (userAgent.indexOf('Chrome') >= 0);
9596
const textEncoder = new TextEncoder();
9697
const textDecoder = new TextDecoder();
9798

@@ -484,9 +485,9 @@ async function webviewPreloads(ctx: PreloadContext) {
484485
deltaY: event.deltaY,
485486
deltaZ: event.deltaZ,
486487
// Refs https://github.com/microsoft/vscode/issues/146403#issuecomment-1854538928
487-
wheelDelta: event.wheelDelta && browser.isChrome ? (event.wheelDelta / $window.devicePixelRatio) : event.wheelDelta,
488-
wheelDeltaX: event.wheelDeltaX && browser.isChrome ? (event.wheelDeltaX / $window.devicePixelRatio) : event.wheelDeltaX,
489-
wheelDeltaY: event.wheelDeltaY && browser.isChrome ? (event.wheelDeltaY / $window.devicePixelRatio) : event.wheelDeltaY,
488+
wheelDelta: event.wheelDelta && isChrome ? (event.wheelDelta / $window.devicePixelRatio) : event.wheelDelta,
489+
wheelDeltaX: event.wheelDeltaX && isChrome ? (event.wheelDeltaX / $window.devicePixelRatio) : event.wheelDeltaX,
490+
wheelDeltaY: event.wheelDeltaY && isChrome ? (event.wheelDeltaY / $window.devicePixelRatio) : event.wheelDeltaY,
490491
detail: event.detail,
491492
shiftKey: event.shiftKey,
492493
type: event.type

0 commit comments

Comments
 (0)