Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RTL] Improve scroll bar responsiveness during updates. #80606

Merged
merged 1 commit into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion scene/gui/rich_text_label.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2745,6 +2745,9 @@ void RichTextLabel::_thread_function(void *p_userdata) {

void RichTextLabel::_thread_end() {
set_physics_process_internal(false);
if (!scroll_visible) {
vscroll->hide();
}
if (is_visible_in_tree()) {
queue_redraw();
}
Expand Down Expand Up @@ -2814,7 +2817,6 @@ _FORCE_INLINE_ float RichTextLabel::_update_scroll_exceeds(float p_total_height,
} else {
scroll_visible = false;
scroll_w = 0;
vscroll->hide();
}

main->first_resized_line.store(0);
Expand Down Expand Up @@ -2862,6 +2864,9 @@ bool RichTextLabel::_validate_line_caches() {
if (main->first_resized_line.load() == (int)main->lines.size()) {
vscroll->set_value(old_scroll);
validating.store(false);
if (!scroll_visible) {
vscroll->hide();
}
return true;
}

Expand All @@ -2881,6 +2886,9 @@ bool RichTextLabel::_validate_line_caches() {
update_minimum_size();
}
validating.store(false);
if (!scroll_visible) {
vscroll->hide();
}
return true;
}
validating.store(false);
Expand All @@ -2896,6 +2904,9 @@ bool RichTextLabel::_validate_line_caches() {
updating.store(true);
_process_line_caches();
updating.store(false);
if (!scroll_visible) {
vscroll->hide();
}
queue_redraw();
return true;
}
Expand Down
8 changes: 8 additions & 0 deletions scene/gui/scroll_bar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,14 @@ void ScrollBar::_notification(int p_what) {
}
} break;

case NOTIFICATION_VISIBILITY_CHANGED: {
if (!is_visible()) {
incr_active = false;
decr_active = false;
drag.active = false;
}
} break;

case NOTIFICATION_MOUSE_EXIT: {
highlight = HIGHLIGHT_NONE;
queue_redraw();
Expand Down