diff --git a/es/Algorithm.js b/es/Algorithm.js index c93e88fa..b61fcab1 100644 --- a/es/Algorithm.js +++ b/es/Algorithm.js @@ -178,6 +178,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 5f22efa9..7f64ec65 100644 --- a/lib/Algorithm.js +++ b/lib/Algorithm.js @@ -187,6 +187,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 f0844eb2..120c2682 100644 --- a/src/Algorithm.ts +++ b/src/Algorithm.ts @@ -207,6 +207,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; }