Fix the position for magnifier of text selction
authorTaeyun An <ty.an@samsung.com>
Tue, 16 Apr 2013 16:35:52 +0000 (01:35 +0900)
committerTaeyun An <ty.an@samsung.com>
Tue, 16 Apr 2013 16:54:11 +0000 (01:54 +0900)
The issue was reproduced after changing the bg image for magnifier.
So, this is the additional patch for the magnifier of which bg image is changed.

[Title] Fix the position for magnifier of text selction
[Issue#] P130404-4384
[Problem] the magnifier got out of screen
[Cause]
[Solution] restrct the postion to the screen

Change-Id: Ia37c2dac1a31786af2e17cd7a2d7650006cf454e

Source/WebKit2/UIProcess/API/efl/tizen/TextSelectionMagnifier.cpp

index b309e3a..38f2c24 100755 (executable)
@@ -125,25 +125,25 @@ void TextSelectionMagnifier::hide()
     evas_object_smart_callback_call(m_viewImpl->view(), "magnifier,hide", 0);
 }
 
+static int s_magnifierMargin = 10;
+static int s_magnifierOffsetY = 220;
+
 void TextSelectionMagnifier::move(const IntPoint& point)
 {
-    int viewX, viewY, viewWidth, viewHeight;
-    evas_object_geometry_get(m_viewImpl->view(), &viewX, &viewY, &viewWidth, &viewHeight);
-
-    int magnfierX, magnfierY, magnfierWidth, magnfierHeight;
-    evas_object_geometry_get(m_magnifier, &magnfierX, &magnfierY, &magnfierWidth, &magnfierHeight);
+    int viewWidth, viewHeight;
+    evas_object_geometry_get(m_viewImpl->view(), 0, 0, &viewWidth, &viewHeight);
 
     int xPosition = point.x();
-    if (xPosition < (magnfierWidth / 2))
-        xPosition = magnfierWidth / 2;
-    if (xPosition > viewWidth - (magnfierWidth / 2))
-        xPosition = viewWidth - (magnfierWidth / 2);
-
-    int yPosition = point.y() - 230;
-    if (yPosition < (magnfierHeight / 2))
-        yPosition = magnfierHeight / 2;
-    if (yPosition > viewHeight - (magnfierHeight / 2))
-        yPosition = viewHeight - (magnfierHeight / 2);
+    if (xPosition < (m_width / 2))
+        xPosition = m_width / 2 + s_magnifierMargin;
+    if (xPosition > viewWidth - (m_width / 2))
+        xPosition = viewWidth - (m_width / 2) - s_magnifierMargin;
+
+    int yPosition = point.y() - s_magnifierOffsetY;
+    if (yPosition < (m_height / 2))
+        yPosition = m_height / 2;
+    if (yPosition > viewHeight - (m_height / 2))
+        yPosition = viewHeight - (m_height / 2);
 
     evas_object_move(m_magnifier, xPosition, yPosition);
 }