[NUI] DragAndDrop: Fit drag window to shadow view
authorTaehyub Kim <taehyub.kim@samsung.com>
Fri, 13 May 2022 07:05:23 +0000 (16:05 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Fri, 27 May 2022 06:02:37 +0000 (15:02 +0900)
src/Tizen.NUI/src/public/DragAndDrop/DragAndDrop.cs
test/NUIDnDSource/NUIDnDSource.cs

index 59b839c..2bbf523 100755 (executable)
@@ -39,8 +39,8 @@ namespace Tizen.NUI
         private Dictionary<View, InternalDragAndDropEventHandler> targetEventDictionary = new Dictionary<View, InternalDragAndDropEventHandler>();
         private View mShadowView;
         private Window mDragWindow;
-        private const int shadowWidth = 150;
-        private const int shadowHeight = 150;
+        private int shadowWidth = 100;
+        private int shadowHeight = 100;
 
         [EditorBrowsable(EditorBrowsableState.Never)]
         private DragAndDrop() : this(Interop.DragAndDrop.New(), true)
@@ -74,6 +74,20 @@ namespace Tizen.NUI
                 throw new ArgumentNullException(nameof(shadowView));
             }
 
+            shadowWidth = (int)shadowView.Size.Width;
+            shadowHeight = (int)shadowView.Size.Height;
+
+            // Prevents shadowView size from being smaller than 100 pixel
+            if (shadowView.Size.Width < 100)
+            {
+                shadowWidth = 100;
+            }
+
+            if (shadowView.Size.Height < 100)
+            {
+                shadowHeight = 100;
+            }
+
             if (null == mDragWindow)
             {
                 mDragWindow = new Window("DragWindow", new Rectangle(-shadowWidth, -shadowHeight, shadowWidth, shadowHeight), true)
@@ -82,7 +96,7 @@ namespace Tizen.NUI
                 };
             }
 
-            shadowView.SetSize(shadowWidth, shadowHeight);
+            mDragWindow.SetWindowSize(new Size(shadowWidth, shadowHeight));
             shadowView.SetOpacity(0.9f);
 
             if (mShadowView)
index af1ddcf..8725d34 100644 (file)
@@ -157,6 +157,7 @@ namespace NUIDnDSource
             {
                 Tizen.Log.Debug("NUIDnDSource", "StartDragAndDrop");
                 shadowView = new ImageView(Tizen.Applications.Application.Current.DirectoryInfo.SharedResource + "dragsource.png");
+                shadowView.Size = new Size(150, 150);
                 DragData dragData;
                 dragData.MimeType = "text/uri-list";
                 dragData.Data = Tizen.Applications.Application.Current.DirectoryInfo.SharedResource + "dragsource.png";