diff options
| author | Ray Koopa | 2017-03-02 22:43:56 +0100 |
|---|---|---|
| committer | Ray Koopa | 2017-03-03 18:45:53 +0100 |
| commit | 7623fd10bf10086f0b2b90bc6ceaa7e32279e645 (patch) | |
| tree | 04c17c3b996e8b5f8a564aaa0a9eb5129a3aad84 /scene/gui/popup.cpp | |
| parent | 74eace2b14b337e23d0dc552f3bc3e60f1710f65 (diff) | |
| download | godot-7623fd10bf10086f0b2b90bc6ceaa7e32279e645.tar.gz godot-7623fd10bf10086f0b2b90bc6ceaa7e32279e645.tar.zst godot-7623fd10bf10086f0b2b90bc6ceaa7e32279e645.zip | |
Diffstat (limited to 'scene/gui/popup.cpp')
| -rw-r--r-- | scene/gui/popup.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp index 60ecd775f..1f0daa99b 100644 --- a/scene/gui/popup.cpp +++ b/scene/gui/popup.cpp @@ -226,12 +226,16 @@ void Popup::popup_centered_ratio(float p_screen_ratio) { } -void Popup::popup() { +void Popup::popup(const Rect2& bounds) { emit_signal("about_to_show"); show_modal(exclusive); - + // Fit the popup into the optionally provided bounds. + if (!bounds.has_no_area()) { + set_pos(bounds.pos); + set_size(bounds.size); + } _fix_size(); Control *focusable = find_next_valid_focus(); @@ -260,7 +264,7 @@ void Popup::_bind_methods() { ClassDB::bind_method(D_METHOD("popup_centered","size"),&Popup::popup_centered,DEFVAL(Size2())); ClassDB::bind_method(D_METHOD("popup_centered_ratio","ratio"),&Popup::popup_centered_ratio,DEFVAL(0.75)); ClassDB::bind_method(D_METHOD("popup_centered_minsize","minsize"),&Popup::popup_centered_minsize,DEFVAL(Size2())); - ClassDB::bind_method(D_METHOD("popup"),&Popup::popup); + ClassDB::bind_method(D_METHOD("popup","bounds"),&Popup::popup,DEFVAL(Rect2())); ClassDB::bind_method(D_METHOD("set_exclusive","enable"),&Popup::set_exclusive); ClassDB::bind_method(D_METHOD("is_exclusive"),&Popup::is_exclusive); ADD_SIGNAL( MethodInfo("about_to_show") ); |
