summaryrefslogtreecommitdiff
path: root/editor/project_manager.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-06-01 11:01:40 +0200
committerGitHub <noreply@github.com>2021-06-01 11:01:40 +0200
commit4c1d555b9a07fa40d7e9237557d8762b3f22d5d5 (patch)
treeaa06d4c13fdf7bca553b835ce9820f20aded595e /editor/project_manager.cpp
parent59b524ae4c1d81150d88fa9618f8f33c1cf6b6ea (diff)
parent6d5b5ba89faf32ad73cf9b1752281b61a13b1538 (diff)
Merge pull request #48770 from LightningAA/scrollcontainer-ensure-item-visible-4.0
ScrollContainer: Expose `_ensure_focused_visible` to the scripting API and rename it to `ensure_control_visible`
Diffstat (limited to 'editor/project_manager.cpp')
-rw-r--r--editor/project_manager.cpp11
1 files changed, 1 insertions, 10 deletions
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index 49a6d28dc1..8bde397b5c 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -1484,16 +1484,7 @@ Vector<ProjectList::Item> ProjectList::get_selected_projects() const {
void ProjectList::ensure_project_visible(int p_index) {
const Item &item = _projects[p_index];
-
- int item_top = item.control->get_position().y;
- int item_bottom = item.control->get_position().y + item.control->get_size().y;
-
- if (item_top < get_v_scroll()) {
- set_v_scroll(item_top);
-
- } else if (item_bottom > get_v_scroll() + get_size().y) {
- set_v_scroll(item_bottom - get_size().y);
- }
+ ensure_control_visible(item.control);
}
int ProjectList::get_single_selected_index() const {