From afaa1a54227ab4b5cb5c0f4729ced05dcccee75f Mon Sep 17 00:00:00 2001 From: Simon Edwards Date: Thu, 15 Jun 2017 22:37:21 +0200 Subject: [PATCH] When drag/dropping something in the middle, place it after the current tab --- src/MainWebUi.ts | 4 ++-- src/SplitLayout.ts | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/MainWebUi.ts b/src/MainWebUi.ts index 58e758c7f..623fb28ff 100755 --- a/src/MainWebUi.ts +++ b/src/MainWebUi.ts @@ -344,9 +344,9 @@ export class MainWebUi extends ThemeableElementBase implements keybindingmanager const target = ev.target; if (target instanceof TabWidget) { if (detail.mimeType === ElementMimeType.MIMETYPE) { - this._handleElementDroppedEvent(target, target.getSelectedIndex(), detail.dropData); + this._handleElementDroppedEvent(target, target.getSelectedIndex() + 1, detail.dropData); } else if (detail.mimeType === FrameMimeType.MIMETYPE) { - this._handleFrameDroppedEvent(target, target.getSelectedIndex(), detail.dropData); + this._handleFrameDroppedEvent(target, target.getSelectedIndex() + 1, detail.dropData); } } } diff --git a/src/SplitLayout.ts b/src/SplitLayout.ts index ad8470217..0b8019cb7 100644 --- a/src/SplitLayout.ts +++ b/src/SplitLayout.ts @@ -417,9 +417,7 @@ export class SplitLayout { const {tabWidgetInfo: sourceTabWidgetInfo, tabInfo} = findTabWidgetInfoByTab(this._rootInfoNode, tabElement); const targetTabWidgetInfo = findTabWidgetInfoByTabWidget(this._rootInfoNode, targetTabWidget); - if (tabIndex > targetTabWidgetInfo.children.length) { - return; - } + tabIndex = Math.min(tabIndex, targetTabWidgetInfo.children.length); if (sourceTabWidgetInfo === targetTabWidgetInfo) { const frontList = sourceTabWidgetInfo.children.slice(0, tabIndex).filter(kid => kid !== tabInfo);