Skip to content

Commit

Permalink
Tap handler for noTabsTitleControl
Browse files Browse the repository at this point in the history
  • Loading branch information
rebornix committed Nov 20, 2019
1 parent 8caf39e commit 2517b60
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions src/vs/workbench/browser/parts/editor/noTabsTitleControl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,10 @@ export class NoTabsTitleControl extends TitleControl {
EventHelper.stop(e, false);

// delayed to let the onTitleClick() come first which can cause a focus change which can close quick open
setTimeout(() => this.quickOpenService.show());
setTimeout(() => {
console.log('quick open show');
this.quickOpenService.show();
});
}

private onTitleDoubleClick(e: MouseEvent): void {
Expand All @@ -100,13 +103,23 @@ export class NoTabsTitleControl extends TitleControl {

private onTitleClick(e: MouseEvent | GestureEvent): void {

// Close editor on middle mouse click
if (e instanceof MouseEvent && e.button === 1 /* Middle Button */) {
EventHelper.stop(e, true /* for https://github.com/Microsoft/vscode/issues/56715 */);
if (e instanceof MouseEvent) {
// Close editor on middle mouse click
if (e.button === 1 /* Middle Button */) {
EventHelper.stop(e, true /* for https://github.com/Microsoft/vscode/issues/56715 */);

if (this.group.activeEditor) {
this.group.closeEditor(this.group.activeEditor);
if (this.group.activeEditor) {
this.group.closeEditor(this.group.activeEditor);
}
}
} else {
// @rebornix
// gesture tap should open the quick open
// editorGroupView will focus on the editor again when there are mouse/pointer/touch down events
// we need to wait a bit as `GesureEvent.Tap` is generated from `touchstart` and then `touchend` evnets, which are not an atom event.
setTimeout(() => {
this.quickOpenService.show();
}, 50);
}
}

Expand Down

0 comments on commit 2517b60

Please sign in to comment.