[RTL] Improve scroll bar responsiveness during updates.

This commit is contained in:
bruvzg 2023-08-14 11:36:05 +03:00
parent 0308422f46
commit 3709ca5404
No known key found for this signature in database
GPG Key ID: 7960FCF39844EC38
2 changed files with 20 additions and 1 deletions

View File

@ -2745,6 +2745,9 @@ void RichTextLabel::_thread_function(void *p_userdata) {
void RichTextLabel::_thread_end() { void RichTextLabel::_thread_end() {
set_physics_process_internal(false); set_physics_process_internal(false);
if (!scroll_visible) {
vscroll->hide();
}
if (is_visible_in_tree()) { if (is_visible_in_tree()) {
queue_redraw(); queue_redraw();
} }
@ -2814,7 +2817,6 @@ _FORCE_INLINE_ float RichTextLabel::_update_scroll_exceeds(float p_total_height,
} else { } else {
scroll_visible = false; scroll_visible = false;
scroll_w = 0; scroll_w = 0;
vscroll->hide();
} }
main->first_resized_line.store(0); main->first_resized_line.store(0);
@ -2862,6 +2864,9 @@ bool RichTextLabel::_validate_line_caches() {
if (main->first_resized_line.load() == (int)main->lines.size()) { if (main->first_resized_line.load() == (int)main->lines.size()) {
vscroll->set_value(old_scroll); vscroll->set_value(old_scroll);
validating.store(false); validating.store(false);
if (!scroll_visible) {
vscroll->hide();
}
return true; return true;
} }
@ -2881,6 +2886,9 @@ bool RichTextLabel::_validate_line_caches() {
update_minimum_size(); update_minimum_size();
} }
validating.store(false); validating.store(false);
if (!scroll_visible) {
vscroll->hide();
}
return true; return true;
} }
validating.store(false); validating.store(false);
@ -2896,6 +2904,9 @@ bool RichTextLabel::_validate_line_caches() {
updating.store(true); updating.store(true);
_process_line_caches(); _process_line_caches();
updating.store(false); updating.store(false);
if (!scroll_visible) {
vscroll->hide();
}
queue_redraw(); queue_redraw();
return true; return true;
} }

View File

@ -428,6 +428,14 @@ void ScrollBar::_notification(int p_what) {
} }
} break; } break;
case NOTIFICATION_VISIBILITY_CHANGED: {
if (!is_visible()) {
incr_active = false;
decr_active = false;
drag.active = false;
}
} break;
case NOTIFICATION_MOUSE_EXIT: { case NOTIFICATION_MOUSE_EXIT: {
highlight = HIGHLIGHT_NONE; highlight = HIGHLIGHT_NONE;
queue_redraw(); queue_redraw();