From 75181f2f5215503d8810a25e591f787fcfe9aa8d Mon Sep 17 00:00:00 2001 From: Taehyub Kim Date: Wed, 18 Oct 2023 20:07:38 +0900 Subject: [PATCH] Add an API to set offset for drag window --- src/Tizen.NUI/src/public/DragAndDrop/DragAndDrop.cs | 16 +++++++++++++++- test/NUIDnDSource/NUIDnDSource.cs | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/Tizen.NUI/src/public/DragAndDrop/DragAndDrop.cs b/src/Tizen.NUI/src/public/DragAndDrop/DragAndDrop.cs index 0e77eb8..52b0c9e 100755 --- a/src/Tizen.NUI/src/public/DragAndDrop/DragAndDrop.cs +++ b/src/Tizen.NUI/src/public/DragAndDrop/DragAndDrop.cs @@ -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"); } } + + /// + /// Sets drag window offset + /// + /// The x direction offset + /// The y direction offset + [EditorBrowsable(EditorBrowsableState.Never)] + public void SetDragWindowOffset(int x, int y) + { + dragWindowOffsetX = x; + dragWindowOffsetY = y; + } } } diff --git a/test/NUIDnDSource/NUIDnDSource.cs b/test/NUIDnDSource/NUIDnDSource.cs index 660db6c..7bceebe 100644 --- a/test/NUIDnDSource/NUIDnDSource.cs +++ b/test/NUIDnDSource/NUIDnDSource.cs @@ -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); -- 2.7.4