From 3fb7584c859856609f1aaa182f3e2c9307d19fa4 Mon Sep 17 00:00:00 2001 From: Taeyun An Date: Sat, 6 Apr 2013 17:04:48 +0900 Subject: [PATCH] Fix the position for magnifier of text selction [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: Ic808cf9cf13ec4ec07efa84ce8afb6c5cca6c7ab --- .../API/efl/tizen/TextSelectionMagnifier.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/Source/WebKit2/UIProcess/API/efl/tizen/TextSelectionMagnifier.cpp b/Source/WebKit2/UIProcess/API/efl/tizen/TextSelectionMagnifier.cpp index ff57eab..fcb7856 100755 --- a/Source/WebKit2/UIProcess/API/efl/tizen/TextSelectionMagnifier.cpp +++ b/Source/WebKit2/UIProcess/API/efl/tizen/TextSelectionMagnifier.cpp @@ -134,7 +134,25 @@ void TextSelectionMagnifier::hide() void TextSelectionMagnifier::move(const IntPoint& point) { - evas_object_move(m_magnifier, point.x(), point.y() -130); + 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_magnifierBackground, &magnfierX, &magnfierY, &magnfierWidth, &magnfierHeight); + + int xPosition = point.x(); + if (xPosition < (magnfierWidth / 2)) + xPosition = magnfierWidth / 2; + if (xPosition > viewWidth - (magnfierWidth / 2)) + xPosition = viewWidth - (magnfierWidth / 2); + + int yPosition = point.y() - 130; + if (yPosition < (magnfierHeight / 2)) + yPosition = magnfierHeight / 2; + if (yPosition > viewHeight - (magnfierHeight / 2)) + yPosition = viewHeight - (magnfierHeight / 2); + + evas_object_move(m_magnifier, xPosition, yPosition); } bool TextSelectionMagnifier::isVisible() -- 2.7.4