Merge pull request #114398 from FifthTundraG/master

Fix `ScrollBar` not accepting `InputEventPanGesture`
This commit is contained in:
Rémi Verschelde 2026-01-06 11:00:03 +01:00
commit cca4e17d5a
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -46,6 +46,37 @@ void ScrollBar::gui_input(const Ref<InputEvent> &p_event) {
Ref<InputEventMouseButton> b = p_event;
Ref<InputEventPanGesture> pg = p_event;
if (pg.is_valid()) {
accept_event();
if (orientation == HORIZONTAL) {
if (pg->get_delta().x != 0) {
if (pg->get_delta().x < 0) {
scroll(-MAX(fabsf(pg->get_delta().x), get_step()));
}
if (pg->get_delta().x > 0) {
scroll(MAX(pg->get_delta().x, get_step()));
}
} else if (pg->get_delta().y != 0) {
if (pg->get_delta().y < 0) {
scroll(-MAX(fabsf(pg->get_delta().y), get_step()));
}
if (pg->get_delta().y > 0) {
scroll(MAX(pg->get_delta().y, get_step()));
}
}
} else {
if (pg->get_delta().y < 0) {
scroll(-MAX(fabsf(pg->get_delta().y), get_step()));
}
if (pg->get_delta().y > 0) {
scroll(MAX(pg->get_delta().y, get_step()));
}
}
}
if (b.is_valid()) {
accept_event();