mirror of
https://github.com/zen-browser/components.git
synced 2025-07-08 14:39:58 +02:00
Fix rearrange view not working with only 2 tabs.
This commit is contained in:
parent
86f01d9343
commit
6b6c4c5bc8
1 changed files with 4 additions and 4 deletions
|
@ -419,20 +419,20 @@ class ZenViewSplitter extends ZenDOMOperatedFeature {
|
||||||
|
|
||||||
let nodeSize;
|
let nodeSize;
|
||||||
let newParent;
|
let newParent;
|
||||||
if (splitDirection === node.parent.direction) {
|
if (splitDirection === node.parent?.direction) {
|
||||||
newParent = node.parent;
|
newParent = node.parent;
|
||||||
nodeSize = node.sizeInParent;
|
nodeSize = node.sizeInParent;
|
||||||
} else {
|
} else {
|
||||||
nodeSize = 100;
|
nodeSize = 100;
|
||||||
const nodeIndex = node.parent.children.indexOf(node);
|
|
||||||
newParent = new SplitNode(splitDirection, node.sizeInParent);
|
newParent = new SplitNode(splitDirection, node.sizeInParent);
|
||||||
if (node.parent) {
|
if (node.parent) {
|
||||||
newParent.parent = node.parent;
|
newParent.parent = node.parent;
|
||||||
|
const nodeIndex = node.parent.children.indexOf(node);
|
||||||
|
node.parent.children[nodeIndex] = newParent;
|
||||||
} else {
|
} 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;
|
viewData.layoutTree = newParent;
|
||||||
}
|
}
|
||||||
node.parent.children[nodeIndex] = newParent;
|
|
||||||
newParent.addChild(node);
|
newParent.addChild(node);
|
||||||
}
|
}
|
||||||
node.sizeInParent = (1 - sizeOfInsertedNode) * nodeSize;
|
node.sizeInParent = (1 - sizeOfInsertedNode) * nodeSize;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue