mirror of
https://github.com/Microsoft/vscode
synced 2024-09-18 01:58:27 +00:00
Cancel mouse down operation when the editor height changes (#113818)
This commit is contained in:
parent
f1d92e7896
commit
a0945131a1
|
@ -71,6 +71,7 @@ export class MouseHandler extends ViewEventHandler {
|
|||
protected mouseTargetFactory: MouseTargetFactory;
|
||||
protected readonly _mouseDownOperation: MouseDownOperation;
|
||||
private lastMouseLeaveTime: number;
|
||||
private _height: number;
|
||||
|
||||
constructor(context: ViewContext, viewController: ViewController, viewHelper: IPointerHandlerHelper) {
|
||||
super();
|
||||
|
@ -89,6 +90,7 @@ export class MouseHandler extends ViewEventHandler {
|
|||
));
|
||||
|
||||
this.lastMouseLeaveTime = -1;
|
||||
this._height = this._context.configuration.options.get(EditorOption.layoutInfo).height;
|
||||
|
||||
const mouseEvents = new EditorMouseEventFactory(this.viewHelper.viewDomNode);
|
||||
|
||||
|
@ -135,6 +137,17 @@ export class MouseHandler extends ViewEventHandler {
|
|||
}
|
||||
|
||||
// --- begin event handlers
|
||||
public onConfigurationChanged(e: viewEvents.ViewConfigurationChangedEvent): boolean {
|
||||
if (e.hasChanged(EditorOption.layoutInfo)) {
|
||||
// layout change
|
||||
const height = this._context.configuration.options.get(EditorOption.layoutInfo).height;
|
||||
if (this._height !== height) {
|
||||
this._height = height;
|
||||
this._mouseDownOperation.onHeightChanged();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public onCursorStateChanged(e: viewEvents.ViewCursorStateChangedEvent): boolean {
|
||||
this._mouseDownOperation.onCursorStateChanged(e);
|
||||
return false;
|
||||
|
@ -401,6 +414,10 @@ class MouseDownOperation extends Disposable {
|
|||
this._onScrollTimeout.cancel();
|
||||
}
|
||||
|
||||
public onHeightChanged(): void {
|
||||
this._mouseMoveMonitor.stopMonitoring();
|
||||
}
|
||||
|
||||
public onScrollChanged(): void {
|
||||
if (!this._isActive) {
|
||||
return;
|
||||
|
|
|
@ -210,4 +210,8 @@ export class GlobalEditorMouseMoveMonitor extends Disposable {
|
|||
onStopCallback(e);
|
||||
});
|
||||
}
|
||||
|
||||
public stopMonitoring(): void {
|
||||
this._globalMouseMoveMonitor.stopMonitoring(true);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue