Merge pull request #61346 from AaronRecord/fix-scrollbars-initializing
This commit is contained in:
commit
4987cd43bf
|
@ -251,18 +251,7 @@ void ScrollContainer::ensure_control_visible(Control *p_control) {
|
|||
set_v_scroll(get_v_scroll() + (diff.y - global_rect.position.y));
|
||||
}
|
||||
|
||||
void ScrollContainer::_notification(int p_what) {
|
||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
|
||||
call_deferred("_update_scrollbar_position");
|
||||
};
|
||||
|
||||
if (p_what == NOTIFICATION_READY) {
|
||||
Viewport *viewport = get_viewport();
|
||||
ERR_FAIL_COND(!viewport);
|
||||
viewport->connect("gui_focus_changed", this, "_gui_focus_changed");
|
||||
}
|
||||
|
||||
if (p_what == NOTIFICATION_SORT_CHILDREN) {
|
||||
void ScrollContainer::_update_dimensions() {
|
||||
child_max_size = Size2(0, 0);
|
||||
Size2 size = get_size();
|
||||
Point2 ofs;
|
||||
|
@ -316,6 +305,22 @@ void ScrollContainer::_notification(int p_what) {
|
|||
}
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
void ScrollContainer::_notification(int p_what) {
|
||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
|
||||
call_deferred("_update_scrollbar_position");
|
||||
};
|
||||
|
||||
if (p_what == NOTIFICATION_READY) {
|
||||
Viewport *viewport = get_viewport();
|
||||
ERR_FAIL_COND(!viewport);
|
||||
viewport->connect("gui_focus_changed", this, "_gui_focus_changed");
|
||||
_update_dimensions();
|
||||
}
|
||||
|
||||
if (p_what == NOTIFICATION_SORT_CHILDREN) {
|
||||
_update_dimensions();
|
||||
};
|
||||
|
||||
if (p_what == NOTIFICATION_DRAW) {
|
||||
|
|
|
@ -70,6 +70,7 @@ protected:
|
|||
|
||||
void _gui_input(const Ref<InputEvent> &p_gui_input);
|
||||
void _gui_focus_changed(Control *p_control);
|
||||
void _update_dimensions();
|
||||
void _notification(int p_what);
|
||||
|
||||
void _scroll_moved(float);
|
||||
|
|
Loading…
Reference in New Issue