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
No known key found for this signature in database
GPG key ID: 8413210218EF35D2
10 changed files with 60 additions and 18 deletions

View file

@ -71,7 +71,7 @@ void EditorFileDialog::_native_popup() {
DisplayServer::get_singleton()->file_dialog_with_options_show(get_displayed_title(), ProjectSettings::get_singleton()->globalize_path(dir->get_text()), root, file->get_text().get_file(), show_hidden_files, DisplayServer::FileDialogMode(mode), processed_filters, _get_options(), callable_mp(this, &EditorFileDialog::_native_dialog_cb), wid);
}
void EditorFileDialog::popup(const Rect2i &p_rect) {
void EditorFileDialog::_popup_base(const Rect2i &p_rect) {
_update_option_controls();
bool use_native = DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_NATIVE_DIALOG_FILE) && (bool(EDITOR_GET("interface/editor/use_native_file_dialogs")) || OS::get_singleton()->is_sandboxed());
@ -79,7 +79,7 @@ void EditorFileDialog::popup(const Rect2i &p_rect) {
_native_popup();
} else {
// Show custom file dialog.
ConfirmationDialog::popup(p_rect);
ConfirmationDialog::_popup_base(p_rect);
}
}

View file

@ -290,6 +290,7 @@ private:
protected:
virtual void _update_theme_item_cache() override;
virtual void _popup_base(const Rect2i &p_rect = Rect2i()) override;
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); }
bool _get(const StringName &p_name, Variant &r_ret) const { return property_helper.property_get_value(p_name, r_ret); }
@ -300,7 +301,6 @@ protected:
public:
virtual void set_visible(bool p_visible) override;
virtual void popup(const Rect2i &p_rect = Rect2i()) override;
// Public for use with callable_mp.
void _file_submitted(const String &p_file);

View file

@ -166,12 +166,12 @@ void EditorVariantTypePopupMenu::_notification(int p_what) {
}
}
void EditorVariantTypePopupMenu::popup(const Rect2i &p_bounds) {
void EditorVariantTypePopupMenu::_popup_base(const Rect2i &p_bounds) {
if (icons_dirty) {
_update_menu_icons();
icons_dirty = false;
}
PopupMenu::popup(p_bounds);
PopupMenu::_popup_base(p_bounds);
}
EditorVariantTypePopupMenu::EditorVariantTypePopupMenu(bool p_remove_item) {

View file

@ -59,9 +59,8 @@ class EditorVariantTypePopupMenu : public PopupMenu {
protected:
void _notification(int p_what);
virtual void _popup_base(const Rect2i &p_bounds = Rect2i()) override;
public:
virtual void popup(const Rect2i &p_bounds = Rect2i()) override;
EditorVariantTypePopupMenu(bool p_remove_item);
};