1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-13 19:54:17 +02:00

Fixed sorting maps breaking after multiple clicks in succession

This commit is contained in:
Ivan Savenko
2023-07-04 19:29:01 +03:00
parent f914ec9d57
commit 4fd5a2b3ea
2 changed files with 16 additions and 4 deletions

View File

@@ -457,10 +457,21 @@ void SelectionTab::updateListItems()
}
}
int SelectionTab::getLine()
bool SelectionTab::receiveEvent(const Point & position, int eventType) const
{
// FIXME: widget should instead have well-defined pos so events will be filtered using standard routine
return getLine(position) != -1;
}
int SelectionTab::getLine() const
{
Point clickPos = GH.getCursorPosition() - pos.topLeft();
return getLine(clickPos);
}
int SelectionTab::getLine(const Point & clickPos) const
{
int line = -1;
Point clickPos = GH.getCursorPosition() - pos.topLeft();
// Ignore clicks on save name area
int maxPosY;

View File

@@ -67,8 +67,8 @@ public:
void clickLeft(tribool down, bool previousState) override;
void keyPressed(EShortcut key) override;
void clickDouble() override;
bool receiveEvent(const Point & position, int eventType) const override;
void filter(int size, bool selectFirst = false); //0 - all
void sortBy(int criteria);
@@ -77,7 +77,8 @@ public:
void selectAbs(int position); //position: absolute position in curItems vector
void sliderMove(int slidPos);
void updateListItems();
int getLine();
int getLine() const;
int getLine(const Point & position) const;
void selectFileName(std::string fname);
std::shared_ptr<CMapInfo> getSelectedMapInfo() const;
void rememberCurrentSelection();