drag-and-drop : Add leave event when dragging is cancelled 44/286644/4
authorTaehyub Kim <taehyub.kim@samsung.com>
Wed, 11 Jan 2023 04:38:09 +0000 (13:38 +0900)
committerTaehyub Kim <taehyub.kim@samsung.com>
Wed, 11 Jan 2023 07:05:47 +0000 (16:05 +0900)
Change-Id: If98ec6b0d766e3a898063456d05c6c82a6df0abc

dali/internal/drag-and-drop/tizen-wayland/drag-and-drop-impl-ecore-wl2.cpp

index b6654e6..ca895f1 100644 (file)
@@ -34,6 +34,11 @@ namespace Internal
 {
 namespace Adaptor
 {
+namespace
+{
+static constexpr int32_t DEFAULT_POSITION = -1;
+}
+
 static bool IsIntersection(int px, int py, int tx, int ty, int tw, int th)
 {
   if(px > tx && py > ty && px < (tx + tw) && py < (ty + th))
@@ -260,6 +265,14 @@ void DragAndDropEcoreWl::ResetDropTargets()
 {
   for(std::size_t i = 0; i < mDropTargets.size(); i++)
   {
+     if(mDropTargets[i].inside)
+     {
+       Dali::DragAndDrop::DragEvent dragEvent;
+       dragEvent.SetAction(Dali::DragAndDrop::DragType::LEAVE);
+       Dali::Vector2 position(DEFAULT_POSITION, DEFAULT_POSITION);
+       dragEvent.SetPosition(position);
+       mDropTargets[i].callback(dragEvent);
+     }
      mDropTargets[i].inside = false;
   }
 }