Fixed an issue where menu rows would not align properly during navigation.

This commit is contained in:
Leon Styhre 2021-08-19 19:53:05 +02:00
parent 9e629e033b
commit 70a1e4612a

View file

@ -179,13 +179,11 @@ void ComponentList::render(const glm::mat4& parentTrans)
dim.x = (trans[0].x * dim.x + trans[3].x) - trans[3].x; dim.x = (trans[0].x * dim.x + trans[3].x) - trans[3].x;
dim.y = (trans[1].y * dim.y + trans[3].y) - trans[3].y; dim.y = (trans[1].y * dim.y + trans[3].y) - trans[3].y;
Renderer::pushClipRect( Renderer::pushClipRect(glm::ivec2{static_cast<int>(trans[3].x), static_cast<int>(trans[3].y)},
glm::ivec2{static_cast<int>(std::round(trans[3].x)), glm::ivec2{static_cast<int>(dim.x), static_cast<int>(dim.y)});
static_cast<int>(std::round(trans[3].y))},
glm::ivec2{static_cast<int>(std::round(dim.x)), static_cast<int>(std::round(dim.y))});
// Scroll the camera. // Scroll the camera.
trans = glm::translate(trans, glm::vec3{0.0f, -std::round(mCameraOffset), 0.0f}); trans = glm::translate(trans, glm::vec3{0.0f, -mCameraOffset, 0.0f});
// Draw our entries. // Draw our entries.
std::vector<GuiComponent*> drawAfterCursor; std::vector<GuiComponent*> drawAfterCursor;
@ -287,7 +285,7 @@ float ComponentList::getRowHeight(const ComponentListRow& row) const
height = row.elements.at(i).component->getSize().y; height = row.elements.at(i).component->getSize().y;
} }
return height; return std::floor(height);
} }
float ComponentList::getTotalRowHeight() const float ComponentList::getTotalRowHeight() const