|
5 | 5 |
|
6 | 6 | import 'vs/css!./walkThroughPart'; |
7 | 7 | import { DomScrollableElement } from 'vs/base/browser/ui/scrollbar/scrollableElement'; |
| 8 | +import { EventType as TouchEventType, GestureEvent, Gesture } from 'vs/base/browser/touch'; |
8 | 9 | import { ScrollbarVisibility } from 'vs/base/common/scrollable'; |
9 | 10 | import * as strings from 'vs/base/common/strings'; |
10 | 11 | import { URI } from 'vs/base/common/uri'; |
@@ -37,6 +38,7 @@ import { INotificationService } from 'vs/platform/notification/common/notificati |
37 | 38 | import { Dimension, size } from 'vs/base/browser/dom'; |
38 | 39 | import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService'; |
39 | 40 | import { CancellationToken } from 'vs/base/common/cancellation'; |
| 41 | +import { domEvent } from 'vs/base/browser/event'; |
40 | 42 |
|
41 | 43 | export const WALK_THROUGH_FOCUS = new RawContextKey<boolean>('interactivePlaygroundFocus', false); |
42 | 44 |
|
@@ -112,6 +114,14 @@ export class WalkThroughPart extends BaseEditor { |
112 | 114 | } |
113 | 115 | } |
114 | 116 |
|
| 117 | + private onTouchChange(event: GestureEvent) { |
| 118 | + event.preventDefault(); |
| 119 | + event.stopPropagation(); |
| 120 | + |
| 121 | + const scrollPosition = this.scrollbar.getScrollPosition(); |
| 122 | + this.scrollbar.setScrollPosition({ scrollTop: scrollPosition.scrollTop - event.translationY }); |
| 123 | + } |
| 124 | + |
115 | 125 | private addEventListener<K extends keyof HTMLElementEventMap, E extends HTMLElement>(element: E, type: K, listener: (this: E, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): IDisposable; |
116 | 126 | private addEventListener<E extends HTMLElement>(element: E, type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): IDisposable; |
117 | 127 | private addEventListener<E extends HTMLElement>(element: E, type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): IDisposable { |
@@ -396,6 +406,8 @@ export class WalkThroughPart extends BaseEditor { |
396 | 406 | this.scrollbar.scanDomNode(); |
397 | 407 | this.loadTextEditorViewState(input); |
398 | 408 | this.updatedScrollPosition(); |
| 409 | + this.contentDisposables.push(Gesture.addTarget(innerContent)); |
| 410 | + this.contentDisposables.push(domEvent(innerContent, TouchEventType.Change)(this.onTouchChange, this, this.disposables)); |
399 | 411 | }); |
400 | 412 | } |
401 | 413 |
|
|
0 commit comments