mirror of
https://github.com/zen-browser/components.git
synced 2025-07-07 20:59:59 +02:00
Merge pull request #42 from BrhmDev/fix/rearrange-view-not-working-with-only-2-tabs
Fix rearrange view not working with only 2 tabs.
This commit is contained in:
commit
3676ca1418
1 changed files with 4 additions and 4 deletions
|
@ -443,20 +443,20 @@ class ZenViewSplitter extends ZenDOMOperatedFeature {
|
|||
|
||||
let nodeSize;
|
||||
let newParent;
|
||||
if (splitDirection === node.parent.direction) {
|
||||
if (splitDirection === node.parent?.direction) {
|
||||
newParent = node.parent;
|
||||
nodeSize = node.sizeInParent;
|
||||
} else {
|
||||
nodeSize = 100;
|
||||
const nodeIndex = node.parent.children.indexOf(node);
|
||||
newParent = new SplitNode(splitDirection, node.sizeInParent);
|
||||
if (node.parent) {
|
||||
newParent.parent = node.parent;
|
||||
const nodeIndex = node.parent.children.indexOf(node);
|
||||
node.parent.children[nodeIndex] = newParent;
|
||||
} else {
|
||||
const viewData = Object.values(this._data).find(s => s.layoutTree === node.parent);
|
||||
const viewData = Object.values(this._data).find(s => s.layoutTree === node);
|
||||
viewData.layoutTree = newParent;
|
||||
}
|
||||
node.parent.children[nodeIndex] = newParent;
|
||||
newParent.addChild(node);
|
||||
}
|
||||
node.sizeInParent = (1 - sizeOfInsertedNode) * nodeSize;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue