mirror of
https://github.com/zen-browser/components.git
synced 2025-07-07 21:59:59 +02:00
Fix node having same direction as parent after removing splitNode (invalid state)
This commit is contained in:
parent
cbeb9d7b68
commit
fcb9af659a
1 changed files with 13 additions and 2 deletions
|
@ -160,8 +160,19 @@ class ZenViewSplitter extends ZenDOMOperatedFeature {
|
|||
const leftOverChild = parent.children[0];
|
||||
leftOverChild.sizeInParent = parent.sizeInParent;
|
||||
if (parent.parent) {
|
||||
leftOverChild.parent = parent.parent;
|
||||
parent.parent.children[parent.parent.children.indexOf(parent)] = leftOverChild;
|
||||
const idx = parent.parent.children.indexOf(parent);
|
||||
if (parent.parent.direction !== leftOverChild.direction) {
|
||||
leftOverChild.parent = parent.parent;
|
||||
parent.parent.children[idx] = leftOverChild;
|
||||
} else {
|
||||
// node cannot have same direction as it's parent
|
||||
leftOverChild.children.forEach(c => {
|
||||
c.sizeInParent *= leftOverChild.sizeInParent / 100
|
||||
c.parent = parent.parent;
|
||||
});
|
||||
parent.parent.children.splice(idx, 1, ...leftOverChild.children);
|
||||
this._removeNodeSplitters(leftOverChild, false);
|
||||
}
|
||||
this._removeNodeSplitters(parent, false);
|
||||
return parent.parent;
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue