1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Fix regressions

This commit is contained in:
Ivan Savenko 2023-07-09 15:15:25 +03:00
parent ca889a5c2a
commit 9449899098
5 changed files with 25 additions and 3 deletions

View File

@ -180,12 +180,13 @@ void EventDispatcher::handleLeftButtonClick(const Point & position, bool isPress
if( i->receiveEvent(GH.getCursorPosition(), AEventsReceiver::LCLICK))
{
i->mouseClickedState = isPressed;
if(isPressed)
i->clickPressed(position);
else
if (i->mouseClickedState && !isPressed)
i->clickReleased(position);
i->mouseClickedState = isPressed;
}
else
{

View File

@ -471,6 +471,14 @@ void TemplatesDropBox::sliderMove(int slidPos)
redraw();
}
bool TemplatesDropBox::receiveEvent(const Point & position, int eventType) const
{
if (eventType == LCLICK)
return true; // we want drop box to close when clicking outside drop box borders
return CIntObject::receiveEvent(position, eventType);
}
void TemplatesDropBox::clickPressed(const Point & cursorPosition)
{
if (!pos.isInside(cursorPosition))

View File

@ -71,6 +71,7 @@ class TemplatesDropBox : public InterfaceObjectConfigurable
public:
TemplatesDropBox(RandomMapTab & randomMapTab, int3 size);
bool receiveEvent(const Point & position, int eventType) const override;
void clickPressed(const Point & cursorPosition) override;
void setTemplate(const CRmgTemplate *);

View File

@ -122,6 +122,11 @@ void CCommanderArtPlace::clickPressed(const Point & cursorPosition)
LOCPLINT->showYesNoDialog(CGI->generaltexth->translate("vcmi.commanderWindow.artifactMessage"), [this]() { returnArtToHeroCallback(); }, []() {});
}
void CCommanderArtPlace::clickReleased(const Point & cursorPosition)
{
// No-op override
}
void CCommanderArtPlace::showPopupWindow(const Point & cursorPosition)
{
if(ourArt && text.size())
@ -184,6 +189,11 @@ void CHeroArtPlace::clickPressed(const Point & cursorPosition)
leftClickCallback(*this);
}
void CHeroArtPlace::clickReleased(const Point & cursorPosition)
{
// No-op override
}
void CHeroArtPlace::showPopupWindow(const Point & cursorPosition)
{
if(rightClickCallback)

View File

@ -58,6 +58,7 @@ protected:
public:
CCommanderArtPlace(Point position, const CGHeroInstance * commanderOwner, ArtifactPosition artSlot, const CArtifactInstance * Art = nullptr);
void clickPressed(const Point & cursorPosition) override;
void clickReleased(const Point & cursorPosition) override;
void showPopupWindow(const Point & cursorPosition) override;
void setArtifact(const CArtifactInstance * art) override;
};
@ -77,6 +78,7 @@ public:
void selectSlot(bool on);
bool isMarked() const;
void clickPressed(const Point & cursorPosition) override;
void clickReleased(const Point & cursorPosition) override;
void showPopupWindow(const Point & cursorPosition) override;
void showAll(Canvas & to) override;
void setArtifact(const CArtifactInstance * art) override;