1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

Added panning gesture, activated by mouse wheel press

This commit is contained in:
Ivan Savenko
2023-05-26 21:46:09 +03:00
parent 1a5c69a424
commit 48859e186e
14 changed files with 55 additions and 137 deletions

View File

@@ -168,7 +168,11 @@ void InputHandler::preprocessEvent(const SDL_Event & ev)
// This prevents freezes when every motion event takes longer to handle than interval at which
// the events arrive (like dragging on the minimap in world view, with redraw at every event)
// so that the events would start piling up faster than they can be processed.
int xAccumulated = eventsQueue.back().motion.xrel + ev.motion.xrel;
int yAccumulated = eventsQueue.back().motion.yrel + ev.motion.yrel;
eventsQueue.back() = ev;
eventsQueue.back().motion.xrel = xAccumulated;
eventsQueue.back().motion.yrel = yAccumulated;
return;
}
eventsQueue.push_back(ev);