Add an API to set offset for drag window
authorTaehyub Kim <taehyub.kim@samsung.com>
Wed, 18 Oct 2023 11:07:38 +0000 (20:07 +0900)
committerEunki Hong <h.pichulia@gmail.com>
Tue, 31 Oct 2023 14:07:28 +0000 (23:07 +0900)
src/Tizen.NUI/src/public/DragAndDrop/DragAndDrop.cs
test/NUIDnDSource/NUIDnDSource.cs

index 0e77eb8..52b0c9e 100755 (executable)
@@ -43,6 +43,8 @@ namespace Tizen.NUI
         private Window mDragWindow;
         private int shadowWidth;
         private int shadowHeight;
+        private int dragWindowOffsetX = 0;
+        private int dragWindowOffsetY = 0;
 
         private bool initDrag = false;
 
@@ -123,7 +125,7 @@ namespace Tizen.NUI
                 shadowHeight = MinDragWindowHeight;
             }
 
-            mDragWindow = new Window("DragWindow", new Rectangle(-shadowWidth, -shadowHeight, shadowWidth, shadowHeight), true)
+            mDragWindow = new Window("DragWindow", new Rectangle(dragWindowOffsetX, dragWindowOffsetY, shadowWidth, shadowHeight), true)
             {
                 BackgroundColor = Color.Transparent,
             };
@@ -313,5 +315,17 @@ namespace Tizen.NUI
                  throw new InvalidOperationException("Fail to RemoveListener for Window");
             }
         }
+
+        /// <summary>
+        /// Sets drag window offset
+        /// </summary>
+        /// <param name="x">The x direction offset</param>
+        /// <param name="y">The y direction offset</param>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void SetDragWindowOffset(int x, int y)
+        {
+            dragWindowOffsetX = x;
+            dragWindowOffsetY = y;
+        }
     }
 }
index 660db6c..7bceebe 100644 (file)
@@ -24,6 +24,7 @@ namespace NUIDnDSource
         {
             // Create DnD Instance
             dnd = DragAndDrop.Instance;
+            dnd.SetDragWindowOffset(-75, -75);
 
             Window.Instance.KeyEvent += OnKeyEvent;
             Window.Instance.WindowSize = new Size(900, 1080);