1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-15 01:24:45 +02:00

Allow defining active areas for sliders. Fixes settings window.

This commit is contained in:
Ivan Savenko
2023-04-02 22:24:07 +03:00
parent 34abc9f82d
commit 507d8bf7fd
5 changed files with 42 additions and 4 deletions

View File

@ -372,7 +372,15 @@ std::shared_ptr<CSlider> InterfaceObjectConfigurable::buildSlider(const JsonNode
auto itemsTotal = config["itemsTotal"].Integer();
auto value = config["selected"].Integer();
bool horizontal = config["orientation"].String() == "horizontal";
return std::make_shared<CSlider>(position, length, callbacks.at(config["callback"].String()), itemsVisible, itemsTotal, value, horizontal, style);
auto const & result = std::make_shared<CSlider>(position, length, callbacks.at(config["callback"].String()), itemsVisible, itemsTotal, value, horizontal, style);
if (!config["scrollBounds"].isNull())
{
Rect bounds = readRect(config["scrollBounds"]);
result->setScrollBounds(bounds);
}
return result;
}
std::shared_ptr<CAnimImage> InterfaceObjectConfigurable::buildImage(const JsonNode & config) const