From 67ef8720aa480bf43e3abbaae92f1dc31450c2f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=ED=99=8D=EC=84=B1=EC=A4=80?= Date: Thu, 3 Nov 2022 14:36:43 +0900 Subject: [PATCH] Keep size when move tab to new window --- es/Algorithm.js | 4 ++++ lib/Algorithm.js | 4 ++++ src/Algorithm.ts | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/es/Algorithm.js b/es/Algorithm.js index cd86155d..e8e2a657 100644 --- a/es/Algorithm.js +++ b/es/Algorithm.js @@ -175,6 +175,10 @@ export function converToPanel(source) { } else { let newPanel = { tabs: [source], group: source.group, activeId: source.id }; + if (source.parent && 'tabs' in source.parent) { + let { x, y, w, h } = source.parent; + newPanel = Object.assign(Object.assign({}, newPanel), { x, y, w, h }); + } source.parent = newPanel; return newPanel; } diff --git a/lib/Algorithm.js b/lib/Algorithm.js index 833d7d17..806564f1 100644 --- a/lib/Algorithm.js +++ b/lib/Algorithm.js @@ -184,6 +184,10 @@ function converToPanel(source) { } else { let newPanel = { tabs: [source], group: source.group, activeId: source.id }; + if (source.parent && 'tabs' in source.parent) { + let { x, y, w, h } = source.parent; + newPanel = Object.assign(Object.assign({}, newPanel), { x, y, w, h }); + } source.parent = newPanel; return newPanel; } diff --git a/src/Algorithm.ts b/src/Algorithm.ts index 0bf8012a..17ab966f 100644 --- a/src/Algorithm.ts +++ b/src/Algorithm.ts @@ -204,6 +204,10 @@ export function converToPanel(source: TabData | PanelData): PanelData { return source; } else { let newPanel: PanelData = {tabs: [source], group: source.group, activeId: source.id}; + if(source.parent && 'tabs' in source.parent) { + let {x, y, w, h} = source.parent; + newPanel = {...newPanel, x, y, w, h}; + } source.parent = newPanel; return newPanel; }