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

Show option description on hovering

This commit is contained in:
Ivan Savenko 2023-07-19 17:08:15 +03:00
parent 8c4faa24f4
commit f3508bdfda
3 changed files with 14 additions and 6 deletions

View File

@ -351,11 +351,11 @@ void CGarrisonSlot::gesture(bool on, const Point & initialPosition, const Point
return;
std::vector<RadialMenuConfig> menuElements = {
{ RadialMenuConfig::ITEM_NW, "stackMerge", "", [this](){owner->bulkMergeStacks(this);} },
{ RadialMenuConfig::ITEM_NE, "stackInfo", "", [this](){viewInfo();} },
{ RadialMenuConfig::ITEM_WW, "stackSplitOne", "", [this](){splitIntoParts(this->getGarrison(), 1); } },
{ RadialMenuConfig::ITEM_EE, "stackSplitEqual", "", [this](){owner->bulkSmartSplitStack(this);} },
{ RadialMenuConfig::ITEM_SW, "heroMove", "", [this](){owner->moveStackToAnotherArmy(this);} },
{ RadialMenuConfig::ITEM_NW, "stackMerge", "Merge same units", [this](){owner->bulkMergeStacks(this);} },
{ RadialMenuConfig::ITEM_NE, "stackInfo", "Show unit information", [this](){viewInfo();} },
{ RadialMenuConfig::ITEM_WW, "stackSplitOne", "Split off single unit", [this](){splitIntoParts(this->getGarrison(), 1); } },
{ RadialMenuConfig::ITEM_EE, "stackSplitEqual", "Split unit equally", [this](){owner->bulkSmartSplitStack(this);} },
{ RadialMenuConfig::ITEM_SW, "heroMove", "Move unit to another army", [this](){owner->moveStackToAnotherArmy(this);} },
};
GH.windows().createAndPushWindow<RadialMenu>(pos.center(), menuElements);

View File

@ -106,7 +106,6 @@ public:
bool smallIcons; ///< true - 32x32 imgs, false - 58x64
bool removableUnits; ///< player Can remove units from up
bool twoRows; ///< slots Will be placed in 2 rows
ESlotsLayout layout;

View File

@ -69,7 +69,16 @@ void RadialMenu::addItem(const Point & offset, const std::string & path, const s
void RadialMenu::gesturePanning(const Point & initialPosition, const Point & currentPosition, const Point & lastUpdateDistance)
{
GH.statusbar()->clear();
for(const auto & item : items)
{
if (item->isInside(currentPosition))
{
GH.statusbar()->write(item->hoverText);
break;
}
}
}
void RadialMenu::gesture(bool on, const Point & initialPosition, const Point & finalPosition)