Skip to content

Commit e2b6dd7

Browse files
committed
💄
1 parent e76b1ff commit e2b6dd7

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

src/vs/workbench/browser/parts/editor/multiEditorTabsControl.ts

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ export class MultiEditorTabsControl extends EditorTabsControl {
131131

132132
private lastMouseWheelEventTime = 0;
133133
private isMouseOverTabs = false;
134+
134135
constructor(
135136
parent: HTMLElement,
136137
editorPartsView: IEditorPartsView,
@@ -1018,7 +1019,7 @@ export class MultiEditorTabsControl extends EditorTabsControl {
10181019

10191020
if (e.dataTransfer) {
10201021
e.dataTransfer.effectAllowed = 'copyMove';
1021-
e.dataTransfer.setDragImage(tab, 0, 0); // top left corner of dragged tab set to cursor position
1022+
e.dataTransfer.setDragImage(tab, 0, 0); // top left corner of dragged tab set to cursor position to make room for drop-border feedback
10221023
}
10231024

10241025
// Apply some datatransfer types to allow for dragging the element outside of the application
@@ -1034,6 +1035,7 @@ export class MultiEditorTabsControl extends EditorTabsControl {
10341035
},
10351036

10361037
onDragEnter: e => {
1038+
10371039
// Return if transfer is unsupported
10381040
if (!this.isSupportedDropTransfer(e)) {
10391041
if (e.dataTransfer) {
@@ -1043,14 +1045,9 @@ export class MultiEditorTabsControl extends EditorTabsControl {
10431045
return;
10441046
}
10451047

1046-
let isLocalDragAndDrop = false;
1047-
if (this.editorTransfer.hasData(DraggedEditorIdentifier.prototype)) {
1048-
isLocalDragAndDrop = true;
1049-
}
1050-
10511048
// Update the dropEffect to "copy" if there is no local data to be dragged because
10521049
// in that case we can only copy the data into and not move it from its source
1053-
if (!isLocalDragAndDrop) {
1050+
if (!this.editorTransfer.hasData(DraggedEditorIdentifier.prototype)) {
10541051
if (e.dataTransfer) {
10551052
e.dataTransfer.dropEffect = 'copy';
10561053
}
@@ -1110,16 +1107,15 @@ export class MultiEditorTabsControl extends EditorTabsControl {
11101107
targetIndex++;
11111108
}
11121109

1113-
// If we are moving an editor inside the same group and it is located before the target index
1114-
// wee need to reduce the index by one to account for the fact that the move will cause all subsequent
1115-
// tabs to move one to the left.
1110+
// If we are moving an editor inside the same group and it is
1111+
// located before the target index we need to reduce the index
1112+
// by one to account for the fact that the move will cause all
1113+
// subsequent tabs to move one to the left.
11161114
const editorIdentifiers = this.editorTransfer.getData(DraggedEditorIdentifier.prototype);
11171115
if (editorIdentifiers !== undefined) {
1118-
11191116
const draggedEditorIdentifier = editorIdentifiers[0].identifier;
11201117
const sourceGroup = this.editorPartsView.getGroup(draggedEditorIdentifier.groupId);
11211118
if (sourceGroup?.id === this.groupView.id) {
1122-
11231119
const editorIndex = sourceGroup.getIndexOfEditor(draggedEditorIdentifier.editor);
11241120
if (editorIndex < targetIndex) {
11251121
targetIndex--;
@@ -1201,6 +1197,7 @@ export class MultiEditorTabsControl extends EditorTabsControl {
12011197
private getTabDragOverLocation(e: DragEvent, tab: HTMLElement): 'left' | 'right' {
12021198
const rect = tab.getBoundingClientRect();
12031199
const offsetXRelativeToParent = e.clientX - rect.left;
1200+
12041201
return offsetXRelativeToParent <= rect.width / 2 ? 'left' : 'right';
12051202
}
12061203

0 commit comments

Comments
 (0)