Clamp size in TextLabel demo 60/36460/1
authorPaul Wisbey <p.wisbey@samsung.com>
Fri, 6 Mar 2015 15:01:40 +0000 (15:01 +0000)
committerPaul Wisbey <p.wisbey@samsung.com>
Fri, 6 Mar 2015 15:01:40 +0000 (15:01 +0000)
Change-Id: I9e07392c5c27a61fb91b25ae03fc2ee5b3b8c0a8

examples/text-label/center-layout-impl.cpp

index e08db35b885152c3205daa0f616c57799d0c1478..04b0720237db72b41c3cfc4acc9b6833d5d72afb 100644 (file)
@@ -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<int>(mLayoutSize.x)),
-                                 ConvertToEven(static_cast<int>(mLayoutSize.y)) );
+  if( mLayoutSize.x >= 2.0f &&
+      mLayoutSize.y >= 2.0f )
+  {
+    // Avoid pixel mis-alignment issue
+    Vector2 clampedSize = Vector2( ConvertToEven(static_cast<int>(mLayoutSize.x)),
+                                   ConvertToEven(static_cast<int>(mLayoutSize.y)) );
 
-  Self().SetSize( clampedSize );
+    Self().SetSize( clampedSize );
 
-  RelayoutRequest();
+    RelayoutRequest();
+  }
 }
 
 } // namespace Internal