Skip to content

Commit ae7fd80

Browse files
committed
Merge pull request #97730 from KoBeWi/rich_text_label_inside_a_scroll_container_inside_a_bag_of_milk
Handle scroll events in RichtTextLabel
2 parents c8accdb + 9bf6148 commit ae7fd80

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

scene/gui/rich_text_label.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2067,16 +2067,27 @@ void RichTextLabel::gui_input(const Ref<InputEvent> &p_event) {
20672067
}
20682068
}
20692069

2070+
bool scroll_value_modified = false;
2071+
double prev_scroll = vscroll->get_value();
2072+
20702073
if (b->get_button_index() == MouseButton::WHEEL_UP) {
20712074
if (scroll_active) {
20722075
vscroll->scroll(-vscroll->get_page() * b->get_factor() * 0.5 / 8);
2076+
scroll_value_modified = true;
20732077
}
20742078
}
20752079
if (b->get_button_index() == MouseButton::WHEEL_DOWN) {
20762080
if (scroll_active) {
20772081
vscroll->scroll(vscroll->get_page() * b->get_factor() * 0.5 / 8);
2082+
scroll_value_modified = true;
20782083
}
20792084
}
2085+
2086+
if (scroll_value_modified && vscroll->get_value() != prev_scroll) {
2087+
accept_event();
2088+
return;
2089+
}
2090+
20802091
if (b->get_button_index() == MouseButton::RIGHT && context_menu_enabled) {
20812092
_update_context_menu();
20822093
menu->set_position(get_screen_position() + b->get_position());

0 commit comments

Comments
 (0)