feat: horizontal scroll

This commit is contained in:
MihailRis 2026-08-07 22:26:58 +03:00
parent 2448869bf9
commit 863cc923a0
4 changed files with 26 additions and 19 deletions

View file

@ -41,10 +41,10 @@ glm::vec2 Panel::getContentSize() const {
void Panel::cropToContent() {
if (maxLength > 0.0f) {
setSize(glm::vec2(
getSize().x, glm::max(minLength, glm::min(maxLength, actualLength))
glm::max(minLength, glm::min(maxLength, actualLengthX)), glm::max(minLength, glm::min(maxLength, actualLengthY))
));
} else {
setSize(glm::vec2(getSize().x, glm::max(minLength, actualLength)));
setSize(glm::vec2(glm::max(minLength, actualLengthX), glm::max(minLength, actualLengthY)));
}
}
@ -93,7 +93,8 @@ void Panel::refresh() {
y += nodeSize.y + margin.w + interval;
maxw = fmax(maxw, ex + nodeSize.x + margin.z + padding.z);
}
actualLength = y + padding.w;
actualLengthX = size.x;
actualLengthY = y + padding.w;
} else {
float maxh = size.y;
for (auto& node : nodes) {
@ -115,6 +116,7 @@ void Panel::refresh() {
x += nodesize.x + margin.z + interval;
maxh = fmax(maxh, ey + nodesize.y + margin.w + padding.w);
}
actualLength = size.y;
actualLengthY = size.y;
actualLengthX = x + padding.z;
}
}