mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2024-12-05 01:11:46 +08:00
More robust saturation mechanism
This commit is contained in:
parent
907e146385
commit
52e92a99be
@ -78,10 +78,10 @@ class HBox : public Node {
|
|||||||
selection.y_max > box_.y_max || selection.x_max > box_.x_max;
|
selection.y_max > box_.y_max || selection.x_max > box_.x_max;
|
||||||
|
|
||||||
if (xmin_saturated) {
|
if (xmin_saturated) {
|
||||||
selection.x_min = box_.x_min;
|
selection.x_min = std::min(box_.x_min, selection.x_min);
|
||||||
}
|
}
|
||||||
if (xmax_saturated) {
|
if (xmax_saturated) {
|
||||||
selection.x_max = box_.x_max;
|
selection.x_max = std::max(box_.x_max, selection.x_max);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& child : children_) {
|
for (auto& child : children_) {
|
||||||
|
@ -76,11 +76,12 @@ class VBox : public Node {
|
|||||||
selection.x_min < box_.x_min || selection.y_min < box_.y_min;
|
selection.x_min < box_.x_min || selection.y_min < box_.y_min;
|
||||||
const bool ymax_saturated =
|
const bool ymax_saturated =
|
||||||
selection.x_max > box_.x_max || selection.y_max > box_.y_max;
|
selection.x_max > box_.x_max || selection.y_max > box_.y_max;
|
||||||
|
|
||||||
if (ymin_saturated) {
|
if (ymin_saturated) {
|
||||||
selection.y_min = box_.y_min;
|
selection.y_min = std::min(box_.y_min, selection.y_min);
|
||||||
}
|
}
|
||||||
if (ymax_saturated) {
|
if (ymax_saturated) {
|
||||||
selection.y_max = box_.y_max;
|
selection.y_max = std::max(box_.y_max, selection.y_max);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& child : children_) {
|
for (auto& child : children_) {
|
||||||
|
Loading…
Reference in New Issue
Block a user