Eliminated some unnecessary processing in DateTimeEditComponent if not right aligning.

This commit is contained in:
Leon Styhre 2021-03-20 11:11:19 +01:00
parent 552368d2f6
commit e3f67b26c3

View file

@ -165,10 +165,12 @@ void DateTimeEditComponent::render(const Transform4x4f& parentTrans)
std::shared_ptr<Font> font = getFont(); std::shared_ptr<Font> font = getFont();
float referenceSize; float referenceSize;
if (mAlignRight) {
if (mTime != 0) if (mTime != 0)
referenceSize = font->sizeText("ABCDEFG").x(); referenceSize = font->sizeText("ABCDEFG").x();
else else
referenceSize = font->sizeText("ABCDEIJ").x(); referenceSize = font->sizeText("ABCDEIJ").x();
}
// Vertically center. // Vertically center.
Vector3f off(0, (mSize.y() - mTextCache->metrics.size.y()) / 2.0f, 0.0f); Vector3f off(0, (mSize.y() - mTextCache->metrics.size.y()) / 2.0f, 0.0f);