Skip to content

Commit

Permalink
Only use the PointerEventHandler on phones (#200317)
Browse files Browse the repository at this point in the history
Only use the PointerEventHandler on phones (fixes #200304)
  • Loading branch information
alexdima authored Dec 8, 2023
1 parent ab0520d commit 57c5c88
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/vs/editor/browser/controller/pointerHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { BrowserFeatures } from 'vs/base/browser/canIUse';
import * as dom from 'vs/base/browser/dom';
import { EventType, Gesture, GestureEvent } from 'vs/base/browser/touch';
import { mainWindow } from 'vs/base/browser/window';
import { Disposable } from 'vs/base/common/lifecycle';
import * as platform from 'vs/base/common/platform';
import { IPointerHandlerHelper, MouseHandler } from 'vs/editor/browser/controller/mouseHandler';
import { TextAreaSyntethicEvents } from 'vs/editor/browser/controller/textAreaInput';
import { NavigationCommandRevealType } from 'vs/editor/browser/coreCommands';
import { IMouseTarget, MouseTargetType } from 'vs/editor/browser/editorBrowser';
import { EditorMouseEvent, EditorPointerEventFactory } from 'vs/editor/browser/editorDom';
import { ViewController } from 'vs/editor/browser/view/viewController';
import { ViewContext } from 'vs/editor/common/viewModel/viewContext';
import { BrowserFeatures } from 'vs/base/browser/canIUse';
import { TextAreaSyntethicEvents } from 'vs/editor/browser/controller/textAreaInput';
import { NavigationCommandRevealType } from 'vs/editor/browser/coreCommands';
import { mainWindow } from 'vs/base/browser/window';

/**
* Currently only tested on iOS 13/ iPadOS.
Expand Down Expand Up @@ -140,7 +141,8 @@ export class PointerHandler extends Disposable {

constructor(context: ViewContext, viewController: ViewController, viewHelper: IPointerHandlerHelper) {
super();
if (BrowserFeatures.pointerEvents) {
const isPhone = platform.isIOS || (platform.isAndroid && platform.isMobile);
if (isPhone && BrowserFeatures.pointerEvents) {
this.handler = this._register(new PointerEventHandler(context, viewController, viewHelper));
} else if (mainWindow.TouchEvent) {
this.handler = this._register(new TouchHandler(context, viewController, viewHelper));
Expand Down

0 comments on commit 57c5c88

Please sign in to comment.