Merge pull request #19334 from guilhermefelipecgs/fix_popup
Fixes popup_centered_* methods, dialogs with wrong sizes and visual script editor
This commit is contained in:
@@ -162,6 +162,7 @@ void Control::_update_minimum_size_cache() {
|
||||
minsize.y = MAX(minsize.y, data.custom_minimum_size.y);
|
||||
data.minimum_size_cache = minsize;
|
||||
data.minimum_size_valid = true;
|
||||
minimum_size_changed();
|
||||
}
|
||||
|
||||
Size2 Control::get_combined_minimum_size() const {
|
||||
@@ -452,10 +453,8 @@ void Control::_notification(int p_notification) {
|
||||
|
||||
} break;
|
||||
case NOTIFICATION_POST_ENTER_TREE: {
|
||||
if (is_visible_in_tree()) {
|
||||
data.minimum_size_valid = false;
|
||||
_size_changed();
|
||||
}
|
||||
data.minimum_size_valid = false;
|
||||
_size_changed();
|
||||
} break;
|
||||
case NOTIFICATION_EXIT_TREE: {
|
||||
|
||||
|
||||
+3
-31
@@ -113,37 +113,9 @@ void Popup::set_as_minsize() {
|
||||
|
||||
void Popup::popup_centered_minsize(const Size2 &p_minsize) {
|
||||
|
||||
Size2 total_minsize = p_minsize;
|
||||
|
||||
for (int i = 0; i < get_child_count(); i++) {
|
||||
|
||||
Control *c = Object::cast_to<Control>(get_child(i));
|
||||
if (!c)
|
||||
continue;
|
||||
if (!c->is_visible())
|
||||
continue;
|
||||
|
||||
Size2 minsize = c->get_combined_minimum_size();
|
||||
|
||||
for (int j = 0; j < 2; j++) {
|
||||
|
||||
Margin m_beg = Margin(0 + j);
|
||||
Margin m_end = Margin(2 + j);
|
||||
|
||||
float margin_begin = c->get_margin(m_beg);
|
||||
float margin_end = c->get_margin(m_end);
|
||||
float anchor_begin = c->get_anchor(m_beg);
|
||||
float anchor_end = c->get_anchor(m_end);
|
||||
|
||||
minsize[j] += margin_begin * (ANCHOR_END - anchor_begin) + margin_end * anchor_end;
|
||||
}
|
||||
|
||||
total_minsize.width = MAX(total_minsize.width, minsize.width);
|
||||
total_minsize.height = MAX(total_minsize.height, minsize.height);
|
||||
}
|
||||
|
||||
popup_centered(total_minsize);
|
||||
popped_up = true;
|
||||
set_custom_minimum_size(p_minsize);
|
||||
_fix_size();
|
||||
popup_centered();
|
||||
}
|
||||
|
||||
void Popup::popup_centered(const Size2 &p_size) {
|
||||
|
||||
Reference in New Issue
Block a user