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

add smooth drag for RMB & fix drag for new windows

This commit is contained in:
Laserlicht
2025-01-19 00:30:23 +01:00
parent 364286e1b9
commit 2ebf1daf0d
6 changed files with 52 additions and 19 deletions

View File

@@ -201,10 +201,20 @@ void EventDispatcher::dispatchShowPopup(const Point & position, int tolerance)
void EventDispatcher::dispatchClosePopup(const Point & position)
{
if (GH.windows().isTopWindowPopup())
GH.windows().popWindows(1);
bool popupOpen = GH.windows().isTopWindowPopup(); // popup can already be closed for mouse dragging with RMB
assert(!GH.windows().isTopWindowPopup());
auto hlp = rclickable;
for(auto & i : hlp)
{
if(!vstd::contains(rclickable, i))
continue;
i->closePopupWindow(!popupOpen);
}
if(popupOpen)
GH.windows().popWindows(1);
}
void EventDispatcher::handleLeftButtonClick(const Point & position, int tolerance, bool isPressed)