mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-17 20:58:07 +02:00
Do not scroll lists in lobby if another item is hovered
This commit is contained in:
parent
f4a218285f
commit
367aa94227
@ -28,6 +28,7 @@
|
||||
#include "../widgets/Images.h"
|
||||
#include "../widgets/MiscWidgets.h"
|
||||
#include "../widgets/ObjectLists.h"
|
||||
#include "../widgets/Slider.h"
|
||||
#include "../widgets/TextControls.h"
|
||||
|
||||
#include "../../lib/CConfigHandler.h"
|
||||
@ -126,6 +127,15 @@ std::shared_ptr<CIntObject> GlobalLobbyWidget::buildItemList(const JsonNode & co
|
||||
|
||||
auto result = std::make_shared<CListBox>(callback, position, itemOffset, visibleAmount, totalAmount, initialPos, sliderMode, Rect(sliderPosition, sliderSize));
|
||||
|
||||
if (result->getSlider())
|
||||
{
|
||||
Point scrollBoundsDimensions(sliderPosition.x + result->getSlider()->pos.w, result->getSlider()->pos.h);
|
||||
Point scrollBoundsOffset = -sliderPosition;
|
||||
|
||||
result->getSlider()->setScrollBounds(Rect(scrollBoundsOffset, scrollBoundsDimensions));
|
||||
result->getSlider()->setPanningStep(itemOffset.length());
|
||||
}
|
||||
|
||||
result->setRedrawParent(true);
|
||||
return result;
|
||||
}
|
||||
|
@ -168,6 +168,11 @@ std::shared_ptr<CIntObject> CListBox::getItem(size_t which)
|
||||
return std::shared_ptr<CIntObject>();
|
||||
}
|
||||
|
||||
std::shared_ptr<CSlider> CListBox::getSlider()
|
||||
{
|
||||
return slider;
|
||||
}
|
||||
|
||||
size_t CListBox::getIndexOf(std::shared_ptr<CIntObject> item)
|
||||
{
|
||||
size_t i=first;
|
||||
|
@ -91,6 +91,8 @@ public:
|
||||
//return item with index which or null if not present
|
||||
std::shared_ptr<CIntObject> getItem(size_t which);
|
||||
|
||||
std::shared_ptr<CSlider> getSlider();
|
||||
|
||||
//return currently active items
|
||||
const std::list<std::shared_ptr<CIntObject>> & getItems();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user