fix DocumentLayout

This commit is contained in:
hippoz 2022-06-12 23:39:38 +03:00
parent 23bde79967
commit cd38bad6ea
No known key found for this signature in database
GPG key ID: 7C52899193467641

View file

@ -21,7 +21,7 @@ void DocumentLayout::run() {
largest_height_so_far = child->rect().height(); largest_height_so_far = child->rect().height();
} }
bool new_row_because_of_control_widget = (child->control_type() == ControlWidgetType::NewRow && largest_height_so_far); bool new_row_because_of_control_widget = (child->control_type() == ControlWidgetType::NewRow);
bool new_row_because_of_justification = (current_position.x() + child->rect().width() + m_margin) >= m_target->rect().width(); bool new_row_because_of_justification = (current_position.x() + child->rect().width() + m_margin) >= m_target->rect().width();
bool should_do_new_row = new_row_because_of_control_widget || new_row_because_of_justification; bool should_do_new_row = new_row_because_of_control_widget || new_row_because_of_justification;
if (should_do_new_row) { if (should_do_new_row) {
@ -31,8 +31,11 @@ void DocumentLayout::run() {
child->rect().set_x(current_position.x()); child->rect().set_x(current_position.x());
child->rect().set_y(current_position.y()); child->rect().set_y(current_position.y());
if (!new_row_because_of_control_widget) {
current_position.add(child->rect().width() + m_margin, 0); current_position.add(child->rect().width() + m_margin, 0);
} }
}
} }
} }