@@ -131,6 +131,7 @@ export class MultiEditorTabsControl extends EditorTabsControl {
131
131
132
132
private lastMouseWheelEventTime = 0 ;
133
133
private isMouseOverTabs = false ;
134
+
134
135
constructor (
135
136
parent : HTMLElement ,
136
137
editorPartsView : IEditorPartsView ,
@@ -1018,7 +1019,7 @@ export class MultiEditorTabsControl extends EditorTabsControl {
1018
1019
1019
1020
if ( e . dataTransfer ) {
1020
1021
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
1022
1023
}
1023
1024
1024
1025
// Apply some datatransfer types to allow for dragging the element outside of the application
@@ -1034,6 +1035,7 @@ export class MultiEditorTabsControl extends EditorTabsControl {
1034
1035
} ,
1035
1036
1036
1037
onDragEnter : e => {
1038
+
1037
1039
// Return if transfer is unsupported
1038
1040
if ( ! this . isSupportedDropTransfer ( e ) ) {
1039
1041
if ( e . dataTransfer ) {
@@ -1043,14 +1045,9 @@ export class MultiEditorTabsControl extends EditorTabsControl {
1043
1045
return ;
1044
1046
}
1045
1047
1046
- let isLocalDragAndDrop = false ;
1047
- if ( this . editorTransfer . hasData ( DraggedEditorIdentifier . prototype ) ) {
1048
- isLocalDragAndDrop = true ;
1049
- }
1050
-
1051
1048
// Update the dropEffect to "copy" if there is no local data to be dragged because
1052
1049
// 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 ) ) {
1054
1051
if ( e . dataTransfer ) {
1055
1052
e . dataTransfer . dropEffect = 'copy' ;
1056
1053
}
@@ -1110,16 +1107,15 @@ export class MultiEditorTabsControl extends EditorTabsControl {
1110
1107
targetIndex ++ ;
1111
1108
}
1112
1109
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.
1116
1114
const editorIdentifiers = this . editorTransfer . getData ( DraggedEditorIdentifier . prototype ) ;
1117
1115
if ( editorIdentifiers !== undefined ) {
1118
-
1119
1116
const draggedEditorIdentifier = editorIdentifiers [ 0 ] . identifier ;
1120
1117
const sourceGroup = this . editorPartsView . getGroup ( draggedEditorIdentifier . groupId ) ;
1121
1118
if ( sourceGroup ?. id === this . groupView . id ) {
1122
-
1123
1119
const editorIndex = sourceGroup . getIndexOfEditor ( draggedEditorIdentifier . editor ) ;
1124
1120
if ( editorIndex < targetIndex ) {
1125
1121
targetIndex -- ;
@@ -1201,6 +1197,7 @@ export class MultiEditorTabsControl extends EditorTabsControl {
1201
1197
private getTabDragOverLocation ( e : DragEvent , tab : HTMLElement ) : 'left' | 'right' {
1202
1198
const rect = tab . getBoundingClientRect ( ) ;
1203
1199
const offsetXRelativeToParent = e . clientX - rect . left ;
1200
+
1204
1201
return offsetXRelativeToParent <= rect . width / 2 ? 'left' : 'right' ;
1205
1202
}
1206
1203
0 commit comments