diff --git a/client/gui/CursorHandler.cpp b/client/gui/CursorHandler.cpp index 54805fb8b..3b534c789 100644 --- a/client/gui/CursorHandler.cpp +++ b/client/gui/CursorHandler.cpp @@ -62,6 +62,8 @@ CursorHandler::CursorHandler() set(Cursor::Map::POINTER); } +CursorHandler::~CursorHandler() = default; + Point CursorHandler::position() const { return pos; diff --git a/client/gui/EventDispatcher.cpp b/client/gui/EventDispatcher.cpp index db1d9ab32..5b3867e14 100644 --- a/client/gui/EventDispatcher.cpp +++ b/client/gui/EventDispatcher.cpp @@ -208,25 +208,29 @@ void EventDispatcher::dispatchTextEditing(const std::string & text) void EventDispatcher::dispatchMouseMoved(const Point & position) { - //sending active, hovered hoverable objects hover() call - EventReceiversList hlp; + EventReceiversList newlyHovered; auto hoverableCopy = hoverable; for(auto & elem : hoverableCopy) { - if(elem->isInside(GH.getCursorPosition())) + if(elem->isInside(position)) { - if (!(elem)->isHovered()) - hlp.push_back((elem)); + if (!elem->isHovered()) + { + newlyHovered.push_back((elem)); + } } - else if ((elem)->isHovered()) + else { - (elem)->hover(false); - (elem)->hoveredState = false; + if (elem->isHovered()) + { + (elem)->hover(false); + (elem)->hoveredState = false; + } } } - for(auto & elem : hlp) + for(auto & elem : newlyHovered) { elem->hover(true); elem->hoveredState = true;