From e3f67b26c351067410aba498be5bf13dffa1ea94 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Sat, 20 Mar 2021 11:11:19 +0100 Subject: [PATCH] Eliminated some unnecessary processing in DateTimeEditComponent if not right aligning. --- es-core/src/components/DateTimeEditComponent.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/es-core/src/components/DateTimeEditComponent.cpp b/es-core/src/components/DateTimeEditComponent.cpp index 62a4a166b..adc9280c3 100644 --- a/es-core/src/components/DateTimeEditComponent.cpp +++ b/es-core/src/components/DateTimeEditComponent.cpp @@ -165,10 +165,12 @@ void DateTimeEditComponent::render(const Transform4x4f& parentTrans) std::shared_ptr font = getFont(); float referenceSize; - if (mTime != 0) - referenceSize = font->sizeText("ABCDEFG").x(); - else - referenceSize = font->sizeText("ABCDEIJ").x(); + if (mAlignRight) { + if (mTime != 0) + referenceSize = font->sizeText("ABCDEFG").x(); + else + referenceSize = font->sizeText("ABCDEIJ").x(); + } // Vertically center. Vector3f off(0, (mSize.y() - mTextCache->metrics.size.y()) / 2.0f, 0.0f);