1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-02-13 13:18:43 +02:00

Fixed mouse wheel in xbrz mode, use mouse position information if

provided by SDL
This commit is contained in:
Ivan Savenko 2024-08-29 12:36:42 +00:00
parent 247be94015
commit 9a2d918360

View File

@ -23,6 +23,7 @@
#include <SDL_events.h>
#include <SDL_hints.h>
#include <SDL_version.h>
InputSourceMouse::InputSourceMouse()
:mouseToleranceDistance(settings["input"]["mouseToleranceDistance"].Integer())
@ -69,7 +70,11 @@ void InputSourceMouse::handleEventMouseButtonDown(const SDL_MouseButtonEvent & b
void InputSourceMouse::handleEventMouseWheel(const SDL_MouseWheelEvent & wheel)
{
GH.events().dispatchMouseScrolled(Point(wheel.x, wheel.y) / GH.screenHandler().getScalingFactor(), GH.getCursorPosition());
#if SDL_VERSION_ATLEAST(2,26,0)
GH.events().dispatchMouseScrolled(Point(wheel.x, wheel.y), Point(wheel.mouseX, wheel.mouseY) / GH.screenHandler().getScalingFactor());
#else
GH.events().dispatchMouseScrolled(Point(wheel.x, wheel.y), GH.getCursorPosition());
#endif
}
void InputSourceMouse::handleEventMouseButtonUp(const SDL_MouseButtonEvent & button)