mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-28 16:29:34 +08:00
Merge dom and component focus (#978)
Instead of two levels of focus with `focus` and `selected`, use a recursive level. The components set the one "active" and hbox/vbox/dbox Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
This commit is contained in:
@@ -54,10 +54,10 @@ class Border : public Node {
|
||||
requirement_.min_x =
|
||||
std::max(requirement_.min_x, children_[1]->requirement().min_x + 2);
|
||||
}
|
||||
requirement_.selected_box.x_min++;
|
||||
requirement_.selected_box.x_max++;
|
||||
requirement_.selected_box.y_min++;
|
||||
requirement_.selected_box.y_max++;
|
||||
requirement_.focused.box.x_min++;
|
||||
requirement_.focused.box.x_max++;
|
||||
requirement_.focused.box.y_min++;
|
||||
requirement_.focused.box.y_max++;
|
||||
}
|
||||
|
||||
void SetBox(Box box) override {
|
||||
@@ -65,7 +65,8 @@ class Border : public Node {
|
||||
if (children_.size() == 2) {
|
||||
Box title_box;
|
||||
title_box.x_min = box.x_min + 1;
|
||||
title_box.x_max = std::min(box.x_max - 1, box.x_min + children_[1]->requirement().min_x);
|
||||
title_box.x_max = std::min(box.x_max - 1,
|
||||
box.x_min + children_[1]->requirement().min_x);
|
||||
title_box.y_min = box.y_min;
|
||||
title_box.y_max = box.y_min;
|
||||
children_[1]->SetBox(title_box);
|
||||
@@ -145,10 +146,8 @@ class BorderPixel : public Node {
|
||||
requirement_.min_x =
|
||||
std::max(requirement_.min_x, children_[1]->requirement().min_x + 2);
|
||||
}
|
||||
requirement_.selected_box.x_min++;
|
||||
requirement_.selected_box.x_max++;
|
||||
requirement_.selected_box.y_min++;
|
||||
requirement_.selected_box.y_max++;
|
||||
|
||||
requirement_.focused.box.Shift(1, 1);
|
||||
}
|
||||
|
||||
void SetBox(Box box) override {
|
||||
|
Reference in New Issue
Block a user