Merge pull request #954 from MihailRis/fix-scroll

fix containers scroll
This commit is contained in:
MihailRis 2026-08-29 21:55:16 +03:00 • committed by GitHub
commit 7c7038c61a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4 additions and 1 deletions

View file

@ -8,6 +8,7 @@ namespace gui {
virtual ~BasePanel() = default;
virtual void setOrientation(Orientation orientation) {
this->mainScrollDir = orientation;
this->orientation = orientation;
refresh();
}

View file

@ -114,7 +114,7 @@ void Container::act(float delta) {
void Container::scrolled(int value) {
auto size = getSize();
bool isVertical = actualLengthY > size.y;
bool isVertical = mainScrollDir == Orientation::VERTICAL;
int diff = (isVertical ? actualLengthY - size.y : actualLengthX - size.x);
int& scroll = (isVertical ? scrollY : scrollX);
@ -245,6 +245,7 @@ void Container::setSize(const glm::vec2& size) {
for (auto& node : nodes) {
node->reposition();
}
scrolled(0);
}
int Container::getScrollStep() const {

View file

@ -20,6 +20,7 @@ namespace gui {
int actualLengthY = 0;
int actualLengthX = 0;
bool scrollable = true;
Orientation mainScrollDir = Orientation::VERTICAL;
bool isScrolling() const {
return scrollbarTriggered;