Update rect after _pre_popup in popup_centered_*.

This commit is contained in:
Pāvels Nadtočajevs
2025-11-10 10:59:11 +02:00
parent 6fd949a6dc
commit adf18ff44d
10 changed files with 60 additions and 18 deletions

View File

@ -95,12 +95,12 @@ bool FileDialog::_can_use_native_popup() {
return DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_NATIVE_DIALOG_FILE);
}
void FileDialog::popup(const Rect2i &p_rect) {
void FileDialog::_popup_base(const Rect2i &p_rect) {
_update_option_controls();
#ifdef TOOLS_ENABLED
if (is_part_of_edited_scene()) {
ConfirmationDialog::popup(p_rect);
ConfirmationDialog::_popup_base(p_rect);
return;
}
#endif
@ -108,7 +108,7 @@ void FileDialog::popup(const Rect2i &p_rect) {
if (_can_use_native_popup() && (use_native_dialog || OS::get_singleton()->is_sandboxed())) {
_native_popup();
} else {
ConfirmationDialog::popup(p_rect);
ConfirmationDialog::_popup_base(p_rect);
}
}

View File

@ -368,6 +368,7 @@ private:
virtual void _post_popup() override;
protected:
virtual void _popup_base(const Rect2i &p_rect = Rect2i()) override;
void _validate_property(PropertyInfo &p_property) const;
void _notification(int p_what);
bool _set(const StringName &p_name, const Variant &p_value) { return property_helper.property_set_value(p_name, p_value); }
@ -385,7 +386,6 @@ protected:
public:
virtual void set_visible(bool p_visible) override;
virtual void popup(const Rect2i &p_rect = Rect2i()) override;
void popup_file_dialog();
void clear_filters();

View File

@ -3211,7 +3211,7 @@ String PopupMenu::_atr(int p_idx, const String &p_text) const {
ERR_FAIL_V_MSG(atr(p_text), "Unexpected auto translate mode: " + itos(items[p_idx].auto_translate_mode));
}
void PopupMenu::popup(const Rect2i &p_bounds) {
void PopupMenu::_popup_base(const Rect2i &p_bounds) {
bool native = global_menu.is_valid();
#ifdef TOOLS_ENABLED
if (is_part_of_edited_scene()) {
@ -3230,7 +3230,7 @@ void PopupMenu::popup(const Rect2i &p_bounds) {
moved = Vector2();
popup_time_msec = OS::get_singleton()->get_ticks_msec();
Popup::popup(p_bounds);
Popup::_popup_base(p_bounds);
}
}

View File

@ -237,6 +237,7 @@ protected:
virtual void remove_child_notify(Node *p_child) override;
virtual void _input_from_window(const Ref<InputEvent> &p_event) override;
virtual void _popup_base(const Rect2i &p_bounds = Rect2i()) override;
void _notification(int p_what);
bool _set(const StringName &p_name, const Variant &p_value);
bool _get(const StringName &p_name, Variant &r_ret) const { return property_helper.property_get_value(p_name, r_ret); }
@ -396,7 +397,6 @@ public:
void set_allow_search(bool p_allow);
bool get_allow_search() const;
virtual void popup(const Rect2i &p_bounds = Rect2i()) override;
virtual void set_visible(bool p_visible) override;
PopupMenu();