mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
lastActivated with overload
This commit is contained in:
parent
53ee843e7e
commit
f9db3d131f
@ -289,13 +289,16 @@ void CInfoBar::tick(uint32_t msPassed)
|
||||
}
|
||||
}
|
||||
|
||||
void CInfoBar::clickReleased(const Point & cursorPosition)
|
||||
void CInfoBar::clickReleased(const Point & cursorPosition, bool lastActivated)
|
||||
{
|
||||
timerCounter = 0;
|
||||
removeUsedEvents(TIME); //expiration trigger from just clicked element is not valid anymore
|
||||
|
||||
if(state == HERO || state == TOWN)
|
||||
showGameStatus();
|
||||
{
|
||||
if(lastActivated)
|
||||
showGameStatus();
|
||||
}
|
||||
else if(state == GAME)
|
||||
showDate();
|
||||
else
|
||||
|
@ -159,7 +159,7 @@ private:
|
||||
|
||||
void tick(uint32_t msPassed) override;
|
||||
|
||||
void clickReleased(const Point & cursorPosition) override;
|
||||
void clickReleased(const Point & cursorPosition, bool lastActivated) override;
|
||||
void showPopupWindow(const Point & cursorPosition) override;
|
||||
void hover(bool on) override;
|
||||
|
||||
|
@ -203,6 +203,7 @@ void EventDispatcher::handleLeftButtonClick(const Point & position, int toleranc
|
||||
// POSSIBLE SOLUTION: make EventReceivers inherit from create_shared_from this and store weak_ptr's in lists
|
||||
AEventsReceiver * nearestElement = findElementInToleranceRange(lclickable, position, AEventsReceiver::LCLICK, tolerance);
|
||||
auto hlp = lclickable;
|
||||
bool lastActivated = true;
|
||||
|
||||
for(auto & i : hlp)
|
||||
{
|
||||
@ -212,13 +213,19 @@ void EventDispatcher::handleLeftButtonClick(const Point & position, int toleranc
|
||||
if( i->receiveEvent(position, AEventsReceiver::LCLICK) || i == nearestElement)
|
||||
{
|
||||
if(isPressed)
|
||||
{
|
||||
i->clickPressed(position);
|
||||
i->clickPressed(position, lastActivated);
|
||||
}
|
||||
|
||||
if (i->mouseClickedState && !isPressed)
|
||||
{
|
||||
i->clickReleased(position);
|
||||
i->clickReleased(position, lastActivated);
|
||||
}
|
||||
|
||||
i->mouseClickedState = isPressed;
|
||||
return;
|
||||
lastActivated = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -45,6 +45,8 @@ protected:
|
||||
public:
|
||||
virtual void clickPressed(const Point & cursorPosition) {}
|
||||
virtual void clickReleased(const Point & cursorPosition) {}
|
||||
virtual void clickPressed(const Point & cursorPosition, bool lastActivated) {}
|
||||
virtual void clickReleased(const Point & cursorPosition, bool lastActivated) {}
|
||||
virtual void clickCancel(const Point & cursorPosition) {}
|
||||
virtual void showPopupWindow(const Point & cursorPosition) {}
|
||||
virtual void clickDouble(const Point & cursorPosition) {}
|
||||
|
Loading…
Reference in New Issue
Block a user