Commit 6ffb190b913a53b91b01acffd5a11671d2e41cdf

Authored by Yoonsang Lee
Committed by Adeel Kazmi
1 parent 306cdf28

Change Dali demo table size calculation

- from DPI based to ratio based

Change-Id: I67bdacdfc971a818c7ac5078052be010e8d2eaac
Showing 1 changed file with 8 additions and 6 deletions
demo/dali-table-view.cpp
... ... @@ -53,10 +53,10 @@ const int MAX_PAGES = 256; ///< Maximum pag
53 53 const int EXAMPLES_PER_ROW = 3;
54 54 const int ROWS_PER_PAGE = 3;
55 55 const int EXAMPLES_PER_PAGE = EXAMPLES_PER_ROW * ROWS_PER_PAGE;
56   -const int BOTTOM_PADDING_HEIGHT = 40;
57   -const int LOGO_MARGIN = 50;
  56 +const float LOGO_MARGIN_RATIO = 0.5f / 0.9f;
  57 +const float BOTTOM_PADDING_RATIO = 0.4f / 0.9f;
58 58 const Vector3 SCROLLVIEW_RELATIVE_SIZE(0.9f, 1.0f, 0.8f ); ///< ScrollView's relative size to its parent
59   -const Vector3 TABLE_RELATIVE_SIZE(0.9f, 1.0f, 0.8f ); ///< TableView's relative size to the entire stage. The Y value will be calculated.
  59 +const Vector3 TABLE_RELATIVE_SIZE(0.9f, 0.9f, 0.8f ); ///< TableView's relative size to the entire stage. The Y value means sum of the logo and table relative heights.
60 60 const float STENCIL_RELATIVE_SIZE = 1.0f;
61 61  
62 62 const float EFFECT_SNAP_DURATION = 0.66f; ///< Scroll Snap Duration for Effects
... ... @@ -290,11 +290,13 @@ void DaliTableView::Initialize( Application&amp; application )
290 290  
291 291 // Add logo
292 292 mLogo = CreateLogo( LOGO_PATH );
293   - const float logoHeight = mLogo.GetImage().GetHeight() + DP(LOGO_MARGIN);
  293 + const float paddingHeight = ( ( 1.f-TABLE_RELATIVE_SIZE.y ) * stageSize.y );
  294 + const float logoMargin = paddingHeight * LOGO_MARGIN_RATIO;
  295 + const float logoHeight = mLogo.GetImage().GetHeight() + logoMargin;
294 296 mRootActor.SetFixedHeight( 1, logoHeight );
295 297  
296   - mButtonsPageRelativeSize = Vector3( TABLE_RELATIVE_SIZE.x, ( stageSize.height - toolbarHeight - logoHeight - DP( BOTTOM_PADDING_HEIGHT ) ) / stageSize.height, TABLE_RELATIVE_SIZE.z );
297   -
  298 + const float bottomMargin = paddingHeight * BOTTOM_PADDING_RATIO;
  299 + mButtonsPageRelativeSize = Vector3( TABLE_RELATIVE_SIZE.x, 1.f - ( toolbarHeight + logoHeight + bottomMargin) / stageSize.height, TABLE_RELATIVE_SIZE.z );
298 300 mRootActor.SetFixedHeight( 2, mButtonsPageRelativeSize.y * stageSize.height );
299 301  
300 302 Alignment alignment = Alignment::New();
... ...