The range of touch coordinates is [0:width - 1] and [0:height - 1] 14/319014/6
authorjoogab.yun <joogab.yun@samsung.com>
Mon, 3 Feb 2025 06:46:48 +0000 (15:46 +0900)
committerjoogab.yun <joogab.yun@samsung.com>
Mon, 3 Feb 2025 07:11:36 +0000 (16:11 +0900)
So, modify coordinate calculation when rotating.

Change-Id: I1ce7788a098104e1a729e2c78a7cf3fb49b7e31a

dali/internal/drag-and-drop/tizen-wayland/drag-and-drop-impl-ecore-wl2.cpp
dali/internal/window-system/common/window-impl.cpp
dali/internal/window-system/gl-window/gl-window-impl.cpp

index 28eeac79b95c680bcb5f3527d301df89a70cc0bb..90935a92a8e8c4bc9a7b00c150de105b4ed8b994 100644 (file)
@@ -500,18 +500,18 @@ Vector2 DragAndDropEcoreWl::RecalculatePositionByOrientation(int x, int y, Dali:
 
   if(angle == 90)
   {
-    newX = size.GetWidth() - y;
+    newX = (size.GetWidth() - 1) - y;
     newY = x;
   }
   else if(angle == 180)
   {
-    newX = size.GetHeight() - x;
-    newY = size.GetWidth() - y;
+    newX = (size.GetHeight() - 1) - x;
+    newY = (size.GetWidth() - 1) - y;
   }
   else if(angle == 270)
   {
     newX = y;
-    newY = size.GetHeight() - x;
+    newY = (size.GetHeight() - 1) - x;
   }
   else
   {
index 4af56add4a9ed062a7a7d3ea962396ef2cf16649..302125a5e6a9e1499562cd570e39c6c16a8c1bae 100644 (file)
@@ -1331,24 +1331,25 @@ Vector2 Window::RecalculatePosition(const Vector2& position)
 {
   Vector2 convertedPosition;
 
+  // Note: We need to subtract 1 from width and height because the range of touch coordinates is from to width - 1 or height - 1
   switch(mRotationAngle)
   {
     case 90:
     {
-      convertedPosition.x = static_cast<float>(mWindowWidth) - position.y;
+      convertedPosition.x = static_cast<float>(mWindowWidth - 1) - position.y;
       convertedPosition.y = position.x;
       break;
     }
     case 180:
     {
-      convertedPosition.x = static_cast<float>(mWindowWidth) - position.x;
-      convertedPosition.y = static_cast<float>(mWindowHeight) - position.y;
+      convertedPosition.x = static_cast<float>(mWindowWidth - 1) - position.x;
+      convertedPosition.y = static_cast<float>(mWindowHeight - 1) - position.y;
       break;
     }
     case 270:
     {
       convertedPosition.x = position.y;
-      convertedPosition.y = static_cast<float>(mWindowHeight) - position.x;
+      convertedPosition.y = static_cast<float>(mWindowHeight - 1) - position.x;
       break;
     }
     default:
index c2787e7d4d18b954ff786a346f7c19d51f15f9b0..028aa97a5ef482118207764d2ecdbb4558d2923a 100644 (file)
@@ -552,24 +552,25 @@ Vector2 GlWindow::RecalculatePosition(const Vector2& position)
 {
   Vector2 convertedPosition;
 
+  // Note: We need to subtract 1 from width and height because the range of touch coordinates is from to width - 1 or height - 1
   switch(mTotalRotationAngle)
   {
     case 90:
     {
-      convertedPosition.x = static_cast<float>(mWindowWidth) - position.y;
+      convertedPosition.x = static_cast<float>(mWindowWidth - 1) - position.y;
       convertedPosition.y = position.x;
       break;
     }
     case 180:
     {
-      convertedPosition.x = static_cast<float>(mWindowWidth) - position.x;
-      convertedPosition.y = static_cast<float>(mWindowHeight) - position.y;
+      convertedPosition.x = static_cast<float>(mWindowWidth - 1) - position.x;
+      convertedPosition.y = static_cast<float>(mWindowHeight - 1) - position.y;
       break;
     }
     case 270:
     {
       convertedPosition.x = position.y;
-      convertedPosition.y = static_cast<float>(mWindowHeight) - position.x;
+      convertedPosition.y = static_cast<float>(mWindowHeight - 1) - position.x;
       break;
     }
     default: