Fixed N_SE-34679 and made to use screen fully.(bg already has margins)
authorclone <ingyou.park@samsung.com>
Tue, 23 Apr 2013 06:26:45 +0000 (15:26 +0900)
committerclone <ingyou.park@samsung.com>
Tue, 23 Apr 2013 09:42:03 +0000 (18:42 +0900)
Change-Id: Ibc0745bbd635f94a3ae0518871189240a2e4bbb4
Signed-off-by: clone <ingyou.park@samsung.com>
src/ui/controls/FUiCtrl_ContextMenuGridPresenter.cpp
src/ui/controls/FUiCtrl_ContextMenuListPresenter.cpp

index dc7642d..df97ed5 100644 (file)
@@ -452,11 +452,11 @@ _ContextMenuGridPresenter::CalculateRect(void)
        }
 
        // calculate body rect
-       // calculate real drawing margin for contextmenu
-       float leftMargin = screenLeftMargin;
-       float rightMargin = screen.width - screenRightMargin;
-       float topMargin = screenTopMargin;
-       float bottomMargin = screen.height - screenBottomMargin;
+       // calculate drawable boundaries for contextmenu
+       float leftBoundary = screenLeftMargin;
+       float rightBoundary = screen.width - screenRightMargin;
+       float topBoundary = screenTopMargin;
+       float bottomBoundary = screen.height - screenBottomMargin;
 
        if (__pModel->GetItemCount() <= 0)
        {
@@ -472,44 +472,44 @@ _ContextMenuGridPresenter::CalculateRect(void)
        {
                // Check touch position
                //  - Check left margin
-               if (anchorPosition.x <= leftMargin + arrowRect.width)
+               if (anchorPosition.x <= leftBoundary + arrowRect.width)
                {
-                       anchorPosition.x = leftMargin + arrowRect.width;
+                       anchorPosition.x = leftBoundary + arrowRect.width;
                }
                //  - check right margin
-               if (anchorPosition.x >= (rightMargin - arrowRect.width))
+               if (anchorPosition.x >= (rightBoundary - arrowRect.width))
                {
-                       anchorPosition.x = rightMargin - arrowRect.width;
+                       anchorPosition.x = rightBoundary - arrowRect.width;
                }
                //  - check top margin
-               if (anchorPosition.y <= topMargin)
+               if (anchorPosition.y <= topBoundary)
                {
-                       anchorPosition.y = topMargin + bodyRect.height;
+                       anchorPosition.y = topBoundary + bodyRect.height;
                }
                //  - check bottom margin
-               if (anchorPosition.y >= bottomMargin)
+               if (anchorPosition.y >= bottomBoundary)
                {
-                       anchorPosition.y = bottomMargin;
+                       anchorPosition.y = bottomBoundary;
                }
 
                // Set body position x
                bodyRect.x = anchorPosition.x - (bodyRect.width / 2.0f);
                //  - Check left margin
-               if (bodyRect.x <= leftMargin)
+               if (bodyRect.x <= leftBoundary)
                {
-                       bodyRect.x = leftMargin;
+                       bodyRect.x = leftBoundary;
                }
                //  - check right margin
-               if ((bodyRect.x + bodyRect.width) >= rightMargin)
+               if ((bodyRect.x + bodyRect.width) >= rightBoundary)
                {
-                       bodyRect.x = rightMargin - bodyRect.width;
+                       bodyRect.x = rightBoundary - bodyRect.width;
                }
                // Set body position y
                bodyRect.y = anchorPosition.y - arrowRect.height - bodyRect.height;
                //  - check top margin
-               if (bodyRect.y <= topMargin)
+               if (bodyRect.y <= topBoundary)
                {
-                       bodyRect.y = topMargin;
+                       bodyRect.y = topBoundary;
                }
 
                windowRect.x = bodyRect.x;
@@ -528,44 +528,44 @@ _ContextMenuGridPresenter::CalculateRect(void)
        {
                // Check touch position
                //  - Check left margin
-               if (anchorPosition.x <= leftMargin + arrowRect.width)
+               if (anchorPosition.x <= leftBoundary + arrowRect.width)
                {
-                       anchorPosition.x = leftMargin + arrowRect.width;
+                       anchorPosition.x = leftBoundary + arrowRect.width;
                }
                //  - check right margin
-               if (anchorPosition.x >= (rightMargin - arrowRect.width))
+               if (anchorPosition.x >= (rightBoundary - arrowRect.width))
                {
-                       anchorPosition.x = rightMargin - arrowRect.width;
+                       anchorPosition.x = rightBoundary - arrowRect.width;
                }
                //  - check top margin
-               if (anchorPosition.y <= topMargin)
+               if (anchorPosition.y <= topBoundary)
                {
-                       anchorPosition.y = topMargin;
+                       anchorPosition.y = topBoundary;
                }
                //  - check bottom margin
-               if (anchorPosition.y >= bottomMargin)
+               if (anchorPosition.y >= bottomBoundary)
                {
-                       anchorPosition.y = bottomMargin;
+                       anchorPosition.y = bottomBoundary;
                }
 
                // Set body position x
                bodyRect.x = anchorPosition.x - (bodyRect.width / 2.0f);
                //  - Check left margin
-               if (bodyRect.x <= leftMargin)
+               if (bodyRect.x <= leftBoundary)
                {
-                       bodyRect.x = leftMargin;
+                       bodyRect.x = leftBoundary;
                }
                //  - check right margin
-               if ((bodyRect.x + bodyRect.width) >= rightMargin)
+               if ((bodyRect.x + bodyRect.width) >= rightBoundary)
                {
-                       bodyRect.x = rightMargin - bodyRect.width;
+                       bodyRect.x = rightBoundary - bodyRect.width;
                }
                // Set body position y
                bodyRect.y = anchorPosition.y + arrowRect.height;
                //  - Check bottom margin
-               if ((bodyRect.y + bodyRect.height) >= bottomMargin)
+               if ((bodyRect.y + bodyRect.height) >= bottomBoundary)
                {
-                       bodyRect.y = bottomMargin - bodyRect.height;
+                       bodyRect.y = bottomBoundary - bodyRect.height;
                }
 
                windowRect.x = bodyRect.x;
@@ -584,50 +584,50 @@ _ContextMenuGridPresenter::CalculateRect(void)
        {
                // Check touch position
                //  - Check left margin
-               if (anchorPosition.x <= leftMargin)
+               if (anchorPosition.x <= leftBoundary)
                {
-                       anchorPosition.x = leftMargin + bodyRect.width;
+                       anchorPosition.x = leftBoundary + bodyRect.width;
                }
                //  - check right margin
-               if (anchorPosition.x >= rightMargin)
+               if (anchorPosition.x >= rightBoundary)
                {
-                       anchorPosition.x = rightMargin;
+                       anchorPosition.x = rightBoundary;
                }
                //  - Check top margin
-               if (anchorPosition.y <= topMargin + arrowRect.height)
+               if (anchorPosition.y <= topBoundary + arrowRect.height)
                {
-                       anchorPosition.y = topMargin + arrowRect.height;
+                       anchorPosition.y = topBoundary + arrowRect.height;
                }
                //  - check bottom margin
-               if (anchorPosition.y >= (bottomMargin - arrowRect.height))
+               if (anchorPosition.y >= (bottomBoundary - arrowRect.height))
                {
-                       anchorPosition.y = bottomMargin - arrowRect.height;
+                       anchorPosition.y = bottomBoundary - arrowRect.height;
                }
 
                // Set body position x
                bodyRect.x = anchorPosition.x - arrowRect.width - bodyRect.width;
                //  - Check left margin
-               if (bodyRect.x <= leftMargin)
+               if (bodyRect.x <= leftBoundary)
                {
-                       bodyRect.x = leftMargin;
+                       bodyRect.x = leftBoundary;
                }
                //  - check right margin
-               if ((bodyRect.x + bodyRect.width + arrowRect.width) >= rightMargin)
+               if ((bodyRect.x + bodyRect.width + arrowRect.width) >= rightBoundary)
                {
-                       bodyRect.x = rightMargin - bodyRect.width - arrowRect.width;
+                       bodyRect.x = rightBoundary - bodyRect.width - arrowRect.width;
                }
 
                // Set body position y
                bodyRect.y = anchorPosition.y - (bodyRect.height / 2.0f);
                // - check top margin
-               if (bodyRect.y <= topMargin)
+               if (bodyRect.y <= topBoundary)
                {
-                       bodyRect.y = topMargin;
+                       bodyRect.y = topBoundary;
                }
                // - check bottom margin
-               if ((bodyRect.y + bodyRect.height) >= bottomMargin)
+               if ((bodyRect.y + bodyRect.height) >= bottomBoundary)
                {
-                       bodyRect.y = bottomMargin - bodyRect.height;
+                       bodyRect.y = bottomBoundary - bodyRect.height;
                }
 
                windowRect.x = bodyRect.x;
@@ -646,52 +646,52 @@ _ContextMenuGridPresenter::CalculateRect(void)
        {
                // Check touch position
                //  - Check top margin
-               if (anchorPosition.x <= leftMargin)
+               if (anchorPosition.x <= leftBoundary)
                {
-                       anchorPosition.x = leftMargin;
+                       anchorPosition.x = leftBoundary;
                }
                //  - check right margin
-               if (anchorPosition.x >= rightMargin)
+               if (anchorPosition.x >= rightBoundary)
                {
-                       anchorPosition.x = rightMargin - bodyRect.width;
+                       anchorPosition.x = rightBoundary - bodyRect.width;
                }
                //  - Check top margin
-               if (anchorPosition.y <= topMargin + arrowRect.height)
+               if (anchorPosition.y <= topBoundary + arrowRect.height)
                {
-                       anchorPosition.y = topMargin + arrowRect.height;
+                       anchorPosition.y = topBoundary + arrowRect.height;
                }
                //  - check bottom margin
-               if (anchorPosition.y >= (bottomMargin - arrowRect.height))
+               if (anchorPosition.y >= (bottomBoundary - arrowRect.height))
                {
-                       anchorPosition.y = bottomMargin - arrowRect.height;
+                       anchorPosition.y = bottomBoundary - arrowRect.height;
                }
 
                // Set body position x
                bodyRect.x = anchorPosition.x + arrowRect.width;
                //  - Check left margin
-               if (bodyRect.x <= leftMargin)
+               if (bodyRect.x <= leftBoundary)
                {
-                       bodyRect.x = leftMargin;
+                       bodyRect.x = leftBoundary;
                }
                //  - check right margin
-               if ((bodyRect.x + bodyRect.width) >= rightMargin)
+               if ((bodyRect.x + bodyRect.width + arrowRect.width) >= rightBoundary)
                {
-                       bodyRect.x = rightMargin - bodyRect.width;
+                       bodyRect.x = rightBoundary - bodyRect.width - arrowRect.width;
                }
                // Set body position y
                bodyRect.y = anchorPosition.y - (bodyRect.height / 2);
                // - check top margin
-               if (bodyRect.y <= topMargin)
+               if (bodyRect.y <= topBoundary)
                {
-                       bodyRect.y = topMargin;
+                       bodyRect.y = topBoundary;
                }
                // - check bottom margin
-               if ((bodyRect.y + bodyRect.height) >= bottomMargin)
+               if ((bodyRect.y + bodyRect.height) >= bottomBoundary)
                {
-                       bodyRect.y = bottomMargin - bodyRect.height;
+                       bodyRect.y = bottomBoundary - bodyRect.height;
                }
 
-               windowRect.x = bodyRect.x + arrowRect.width;
+               windowRect.x = bodyRect.x - arrowRect.width;
                windowRect.y = bodyRect.y;
                windowRect.width = bodyRect.width + arrowRect.width;
                windowRect.height = bodyRect.height;
index 3ef5b6e..bebd566 100644 (file)
@@ -446,11 +446,11 @@ _ContextMenuListPresenter::CalculateRect(void)
        }
 
        // calculate body rect
-       // calculate real drawing margin for contextmenu
-       float leftMargin = screenLeftMargin;
-       float rightMargin = screen.width - screenRightMargin;
-       float topMargin = screenTopMargin;
-       float bottomMargin = screen.height - screenBottomMargin;
+       // calculate drawable boundaries for contextmenu
+       float leftBoundary = screenLeftMargin;
+       float rightBoundary = screen.width - screenRightMargin;
+       float topBoundary = screenTopMargin;
+       float bottomBoundary = screen.height - screenBottomMargin;
 
        // calculate layout size (__layoutSize)
        AdjustItemLayout();
@@ -463,44 +463,44 @@ _ContextMenuListPresenter::CalculateRect(void)
        {
                // Check touch position
                //  - Check left margin
-               if (anchorPosition.x <= leftMargin + arrowRect.width)
+               if (anchorPosition.x <= leftBoundary + arrowRect.width)
                {
-                       anchorPosition.x = leftMargin + arrowRect.width;
+                       anchorPosition.x = leftBoundary + arrowRect.width;
                }
                //  - check right margin
-               if (anchorPosition.x >= (rightMargin - arrowRect.width))
+               if (anchorPosition.x >= (rightBoundary - arrowRect.width))
                {
-                       anchorPosition.x = rightMargin - arrowRect.width;
+                       anchorPosition.x = rightBoundary - arrowRect.width;
                }
                //  - check top margin
-               if (anchorPosition.y <= topMargin)
+               if (anchorPosition.y <= topBoundary)
                {
-                       anchorPosition.y = topMargin + bodyRect.height;
+                       anchorPosition.y = topBoundary + bodyRect.height;
                }
                //  - check bottom margin
-               if (anchorPosition.y >= bottomMargin)
+               if (anchorPosition.y >= bottomBoundary)
                {
-                       anchorPosition.y = bottomMargin;
+                       anchorPosition.y = bottomBoundary;
                }
 
                // Set body position x
                bodyRect.x = anchorPosition.x - (bodyRect.width / 2.0f);
                //  - Check left margin
-               if (bodyRect.x <= leftMargin)
+               if (bodyRect.x <= leftBoundary)
                {
-                       bodyRect.x = leftMargin;
+                       bodyRect.x = leftBoundary;
                }
                //  - check right margin
-               if ((bodyRect.x + bodyRect.width) >= rightMargin)
+               if ((bodyRect.x + bodyRect.width) >= rightBoundary)
                {
-                       bodyRect.x = rightMargin - bodyRect.width;
+                       bodyRect.x = rightBoundary - bodyRect.width;
                }
                // Set body position y
                bodyRect.y = anchorPosition.y - arrowRect.height - bodyRect.height;
                //  - check top margin
-               if (bodyRect.y <= topMargin)
+               if (bodyRect.y <= topBoundary)
                {
-                       bodyRect.y = topMargin;
+                       bodyRect.y = topBoundary;
                }
 
                windowRect.x = bodyRect.x;
@@ -519,44 +519,44 @@ _ContextMenuListPresenter::CalculateRect(void)
        {
                // Check touch position
                //  - Check left margin
-               if (anchorPosition.x <= leftMargin + arrowRect.width)
+               if (anchorPosition.x <= leftBoundary + arrowRect.width)
                {
-                       anchorPosition.x = leftMargin + arrowRect.width;
+                       anchorPosition.x = leftBoundary + arrowRect.width;
                }
                //  - check right margin
-               if (anchorPosition.x >= (rightMargin - arrowRect.width))
+               if (anchorPosition.x >= (rightBoundary - arrowRect.width))
                {
-                       anchorPosition.x = rightMargin - arrowRect.width;
+                       anchorPosition.x = rightBoundary - arrowRect.width;
                }
                //  - check top margin
-               if (anchorPosition.y <= topMargin)
+               if (anchorPosition.y <= topBoundary)
                {
-                       anchorPosition.y = topMargin;
+                       anchorPosition.y = topBoundary;
                }
                //  - check bottom margin
-               if (anchorPosition.y >= bottomMargin)
+               if (anchorPosition.y >= bottomBoundary)
                {
-                       anchorPosition.y = bottomMargin;
+                       anchorPosition.y = bottomBoundary;
                }
 
                // Set body position x
                bodyRect.x = anchorPosition.x - (bodyRect.width / 2.0f);
                //  - Check left margin
-               if (bodyRect.x <= leftMargin)
+               if (bodyRect.x <= leftBoundary)
                {
-                       bodyRect.x = leftMargin;
+                       bodyRect.x = leftBoundary;
                }
                //  - check right margin
-               if ((bodyRect.x + bodyRect.width) >= rightMargin)
+               if ((bodyRect.x + bodyRect.width) >= rightBoundary)
                {
-                       bodyRect.x = rightMargin - bodyRect.width;
+                       bodyRect.x = rightBoundary - bodyRect.width;
                }
                // Set body position y
                bodyRect.y = anchorPosition.y + arrowRect.height;
                //  - Check bottom margin
-               if ((bodyRect.y + bodyRect.height) >= bottomMargin)
+               if ((bodyRect.y + bodyRect.height) >= bottomBoundary)
                {
-                       bodyRect.y = bottomMargin - bodyRect.height;
+                       bodyRect.y = bottomBoundary - bodyRect.height;
                }
 
                windowRect.x = bodyRect.x;
@@ -575,50 +575,50 @@ _ContextMenuListPresenter::CalculateRect(void)
        {
                // Check touch position
                //  - Check left margin
-               if (anchorPosition.x <= leftMargin)
+               if (anchorPosition.x <= leftBoundary)
                {
-                       anchorPosition.x = leftMargin + bodyRect.width;
+                       anchorPosition.x = leftBoundary + bodyRect.width;
                }
                //  - check right margin
-               if (anchorPosition.x >= rightMargin)
+               if (anchorPosition.x >= rightBoundary)
                {
-                       anchorPosition.x = rightMargin;
+                       anchorPosition.x = rightBoundary;
                }
                //  - Check top margin
-               if (anchorPosition.y <= topMargin + arrowRect.height)
+               if (anchorPosition.y <= topBoundary + arrowRect.height)
                {
-                       anchorPosition.y = topMargin + arrowRect.height;
+                       anchorPosition.y = topBoundary + arrowRect.height;
                }
                //  - check bottom margin
-               if (anchorPosition.y >= (bottomMargin - arrowRect.height))
+               if (anchorPosition.y >= (bottomBoundary - arrowRect.height))
                {
-                       anchorPosition.y = bottomMargin - arrowRect.height;
+                       anchorPosition.y = bottomBoundary - arrowRect.height;
                }
 
                // Set body position x
                bodyRect.x = anchorPosition.x - arrowRect.width - bodyRect.width;
                //  - Check left margin
-               if (bodyRect.x <= leftMargin)
+               if (bodyRect.x <= leftBoundary)
                {
-                       bodyRect.x = leftMargin;
+                       bodyRect.x = leftBoundary;
                }
                //  - check right margin
-               if ((bodyRect.x + bodyRect.width + arrowRect.width) >= rightMargin)
+               if ((bodyRect.x + bodyRect.width + arrowRect.width) >= rightBoundary)
                {
-                       bodyRect.x = rightMargin - bodyRect.width - arrowRect.width;
+                       bodyRect.x = rightBoundary - bodyRect.width - arrowRect.width;
                }
 
                // Set body position y
                bodyRect.y = anchorPosition.y - (bodyRect.height / 2.0f);
                // - check top margin
-               if (bodyRect.y <= topMargin)
+               if (bodyRect.y <= topBoundary)
                {
-                       bodyRect.y = topMargin;
+                       bodyRect.y = topBoundary;
                }
                // - check bottom margin
-               if ((bodyRect.y + bodyRect.height) >= bottomMargin)
+               if ((bodyRect.y + bodyRect.height) >= bottomBoundary)
                {
-                       bodyRect.y = bottomMargin - bodyRect.height;
+                       bodyRect.y = bottomBoundary - bodyRect.height;
                }
 
                windowRect.x = bodyRect.x;
@@ -637,52 +637,52 @@ _ContextMenuListPresenter::CalculateRect(void)
        {
                // Check touch position
                //  - Check top margin
-               if (anchorPosition.x <= leftMargin)
+               if (anchorPosition.x <= leftBoundary)
                {
-                       anchorPosition.x = leftMargin;
+                       anchorPosition.x = leftBoundary;
                }
                //  - check right margin
-               if (anchorPosition.x >= rightMargin)
+               if (anchorPosition.x >= rightBoundary)
                {
-                       anchorPosition.x = rightMargin - bodyRect.width;
+                       anchorPosition.x = rightBoundary - bodyRect.width;
                }
                //  - Check top margin
-               if (anchorPosition.y <= topMargin + arrowRect.height)
+               if (anchorPosition.y <= topBoundary + arrowRect.height)
                {
-                       anchorPosition.y = topMargin + arrowRect.height;
+                       anchorPosition.y = topBoundary + arrowRect.height;
                }
                //  - check bottom margin
-               if (anchorPosition.y >= (bottomMargin - arrowRect.height))
+               if (anchorPosition.y >= (bottomBoundary - arrowRect.height))
                {
-                       anchorPosition.y = bottomMargin - arrowRect.height;
+                       anchorPosition.y = bottomBoundary - arrowRect.height;
                }
 
                // Set body position x
                bodyRect.x = anchorPosition.x + arrowRect.width;
                //  - Check left margin
-               if (bodyRect.x <= leftMargin)
+               if (bodyRect.x <= leftBoundary)
                {
-                       bodyRect.x = leftMargin;
+                       bodyRect.x = leftBoundary;
                }
                //  - check right margin
-               if ((bodyRect.x + bodyRect.width) >= rightMargin)
+               if ((bodyRect.x + bodyRect.width + arrowRect.width) >= rightBoundary)
                {
-                       bodyRect.x = rightMargin - bodyRect.width;
+                       bodyRect.x = rightBoundary - bodyRect.width - arrowRect.width;
                }
                // Set body position y
                bodyRect.y = anchorPosition.y - (bodyRect.height / 2.0f);
                // - check top margin
-               if (bodyRect.y <= topMargin)
+               if (bodyRect.y <= topBoundary)
                {
-                       bodyRect.y = topMargin;
+                       bodyRect.y = topBoundary;
                }
                // - check bottom margin
-               if ((bodyRect.y + bodyRect.height) >= bottomMargin)
+               if ((bodyRect.y + bodyRect.height) >= bottomBoundary)
                {
-                       bodyRect.y = bottomMargin - bodyRect.height;
+                       bodyRect.y = bottomBoundary - bodyRect.height;
                }
 
-               windowRect.x = bodyRect.x + arrowRect.width;
+               windowRect.x = bodyRect.x - arrowRect.width;
                windowRect.y = bodyRect.y;
                windowRect.width = bodyRect.width + arrowRect.width;
                windowRect.height = bodyRect.height;