mirror of
https://github.com/Trensa-Organization/hy3.git
synced 2025-03-16 03:03:40 +01:00
Fix root group escaping causing infinite group nesting
This commit is contained in:
parent
9b570f066a
commit
c679d16f5a
1 changed files with 19 additions and 14 deletions
|
@ -1098,6 +1098,9 @@ Hy3Node* Hy3Layout::shiftOrGetFocus(Hy3Node& node, ShiftDirection direction, boo
|
|||
// there's no reason to wrap the root group.
|
||||
if (shiftMatchesLayout(group.layout, direction)) break;
|
||||
|
||||
if (group.layout != Hy3GroupLayout::Tabbed && group.children.size() == 2) {
|
||||
group.layout = shiftIsVertical(direction) ? Hy3GroupLayout::SplitV : Hy3GroupLayout::SplitH;
|
||||
} else {
|
||||
// wrap the root group in another group
|
||||
this->nodes.push_back({
|
||||
.parent = break_parent,
|
||||
|
@ -1113,6 +1116,8 @@ Hy3Node* Hy3Layout::shiftOrGetFocus(Hy3Node& node, ShiftDirection direction, boo
|
|||
break_parent->data.as_group.children.push_back(newChild);
|
||||
break_parent->data.as_group.lastFocusedChild = newChild;
|
||||
break_origin = newChild;
|
||||
}
|
||||
|
||||
break;
|
||||
} else {
|
||||
break_origin = break_parent;
|
||||
|
|
Loading…
Add table
Reference in a new issue