ScrollBar: Fix compilation with precision=double

This commit is contained in:
Ricard Rovira Cubeles 2026-03-08 19:40:49 +01:00 committed by Rémi Verschelde
parent 74de2ec047
commit ae2d544f61
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -58,14 +58,14 @@ void ScrollBar::gui_input(const Ref<InputEvent> &p_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()));
scroll(-MAX(Math::abs(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()));
scroll(-MAX(Math::abs(pg->get_delta().y), get_step()));
}
if (pg->get_delta().y > 0) {
scroll(MAX(pg->get_delta().y, get_step()));
@ -73,7 +73,7 @@ void ScrollBar::gui_input(const Ref<InputEvent> &p_event) {
}
} else {
if (pg->get_delta().y < 0) {
scroll(-MAX(fabsf(pg->get_delta().y), get_step()));
scroll(-MAX(Math::abs(pg->get_delta().y), get_step()));
}
if (pg->get_delta().y > 0) {
scroll(MAX(pg->get_delta().y, get_step()));
@ -373,7 +373,7 @@ void ScrollBar::_notification(int p_what) {
if (scrolling) {
if (get_value() != target_scroll) {
double target = target_scroll - get_value();
double dist = std::abs(target);
double dist = Math::abs(target);
double vel = ((target / dist) * 500) * get_process_delta_time();
if (Math::abs(vel) >= dist) {