From 1bd2ed2aad0e9caae33d63cc82fad7ebba36d47d Mon Sep 17 00:00:00 2001
From: Paul Wisbey
Date: Fri, 6 Mar 2015 15:01:40 +0000
Subject: [PATCH] Clamp size in TextLabel demo
Change-Id: I9e07392c5c27a61fb91b25ae03fc2ee5b3b8c0a8
---
examples/text-label/center-layout-impl.cpp | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/examples/text-label/center-layout-impl.cpp b/examples/text-label/center-layout-impl.cpp
index e08db35..04b0720 100644
--- a/examples/text-label/center-layout-impl.cpp
+++ b/examples/text-label/center-layout-impl.cpp
@@ -116,13 +116,17 @@ void CenterLayout::OnPan( Actor actor, const PanGesture& gesture )
mLayoutSize.x += gesture.displacement.x * 2.0f;
mLayoutSize.y += gesture.displacement.y * 2.0f;
- // Avoid pixel mis-alignment issue
- Vector2 clampedSize = Vector2( ConvertToEven(static_cast(mLayoutSize.x)),
- ConvertToEven(static_cast(mLayoutSize.y)) );
+ if( mLayoutSize.x >= 2.0f &&
+ mLayoutSize.y >= 2.0f )
+ {
+ // Avoid pixel mis-alignment issue
+ Vector2 clampedSize = Vector2( ConvertToEven(static_cast(mLayoutSize.x)),
+ ConvertToEven(static_cast(mLayoutSize.y)) );
- Self().SetSize( clampedSize );
+ Self().SetSize( clampedSize );
- RelayoutRequest();
+ RelayoutRequest();
+ }
}
} // namespace Internal
--
2.7.4