mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-21 20:26:41 +00:00
Support for SDL2's mouse wheel event in the GUI1 scrollbar.
This commit is contained in:
parent
85e8c45273
commit
5e96c47d2e
@ -375,6 +375,21 @@ void scrollbar::handle_event(const SDL_Event& event)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#if SDL_VERSION_ATLEAST(2,0,0)
|
||||||
|
case SDL_MOUSEWHEEL:
|
||||||
|
{
|
||||||
|
const SDL_MouseWheelEvent& e = event.wheel;
|
||||||
|
int x, y;
|
||||||
|
SDL_GetMouseState(&x, &y);
|
||||||
|
bool on_groove = point_in_rect(x, y, groove);
|
||||||
|
if (on_groove && e.y < 0) {
|
||||||
|
move_position(scroll_rate_);
|
||||||
|
} else if (on_groove && e.y > 0) {
|
||||||
|
move_position(-scroll_rate_);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user