diff options
Diffstat (limited to 'scene/gui/control.cpp')
-rw-r--r-- | scene/gui/control.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 97daeceda9..2cdee4641e 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -1173,7 +1173,17 @@ Rect2 Control::get_parent_anchorable_rect() const { if (data.parent_canvas_item) { parent_rect = data.parent_canvas_item->get_anchorable_rect(); } else { +#ifdef TOOLS_ENABLED + Node *edited_root = get_tree()->get_edited_scene_root(); + if (edited_root && (this == edited_root || edited_root->is_a_parent_of(this))) { + parent_rect.size = Size2(ProjectSettings::get_singleton()->get("display/window/size/width"), ProjectSettings::get_singleton()->get("display/window/size/height")); + } else { + parent_rect = get_viewport()->get_visible_rect(); + } + +#else parent_rect = get_viewport()->get_visible_rect(); +#endif } return parent_rect; |