Fixed an issue where the scissor box size in ScrollableContainer was sometimes not calculated correctly

This commit is contained in:
Leon Styhre 2023-03-26 19:29:35 +02:00
parent 8384b714ac
commit 8545c619ed

View file

@ -243,13 +243,7 @@ void ScrollableContainer::render(const glm::mat4& parentTrans)
glm::mat4 trans {parentTrans * getTransform()}; glm::mat4 trans {parentTrans * getTransform()};
glm::ivec2 clipPos {static_cast<int>(trans[3].x), static_cast<int>(trans[3].y)}; glm::ivec2 clipPos {static_cast<int>(trans[3].x), static_cast<int>(trans[3].y)};
glm::ivec2 clipDim {mSize.x, mAdjustedHeight};
glm::vec3 dimScaled {0.0f, 0.0f, 0.0f};
dimScaled.x = std::fabs(trans[3].x + mSize.x);
dimScaled.y = std::fabs(trans[3].y + mAdjustedHeight);
glm::ivec2 clipDim {static_cast<int>(dimScaled.x - trans[3].x),
static_cast<int>(dimScaled.y - trans[3].y)};
// By effectively clipping the upper and lower boundaries of the container we mostly avoid // By effectively clipping the upper and lower boundaries of the container we mostly avoid
// scrolling outside the vertical starting and ending positions. // scrolling outside the vertical starting and ending positions.