src/vs/base/browser/globalPointerMoveMonitor.ts/GlobalPointerMoveMonitor/startMonitoring
class GlobalPointerMoveMonitor:	public startMonitoring(
		initialElement: Element,
		pointerId: number,
		initialButtons: number,
		pointerMoveEventMerger: IEventMerger<R>,
		pointerMoveCallback: IPointerMoveCallback<R>,
		onStopCallback: IOnStopCallback
	): void {
		if (this.isMonitoring()) {
			this.stopMonitoring(false);
		}
		this._pointerMoveEventMerger = pointerMoveEventMerger;
		this._pointerMoveCallback = pointerMoveCallback;
		this._onStopCallback = onStopCallback;

		try {
			initialElement.setPointerCapture(pointerId);
			this._hooks.add(toDisposable(() => {
				initialElement.releasePointerCapture(pointerId);
			}));
		} catch (err) {
			// See https://github.com/microsoft/vscode/issues/144584
			// `setPointerCapture` sometimes fails when being invoked from a `mousedown` listener
			// Things appear to work even with `setPointerCapture` failing, so no need to do anything special.
		}

		this._hooks.add(dom.addDisposableThrottledListener<R, PointerEvent>(
			initialElement,
			dom.EventType.POINTER_MOVE,
			(data: R) => {
				if (data.buttons !== initialButtons) {
					// Buttons state has changed in the meantime
					this.stopMonitoring(true);
					return;
				}
				this._pointerMoveCallback!(data);
			},
			(lastEvent: R | null, currentEvent) => this._pointerMoveEventMerger!(lastEvent, currentEvent)
		));

		this._hooks.add(dom.addDisposableListener(
			initialElement,
			dom.EventType.POINTER_UP,
			(e: PointerEvent) => this.stopMonitoring(true)
		));
	}