Merge "Add FittingMode for image" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / drag-drop-detector / drag-and-drop-detector-impl.cpp
index c26e4ae..ed1d2b3 100755 (executable)
@@ -126,26 +126,6 @@ void DragAndDropDetector::OnPan(Dali::Actor actor, const PanGesture& gesture)
   if(gesture.state == Gesture::Started)
   {
     mDragLocalPosition = gesture.position;
-  }
-  if(gesture.state == Gesture::Continuing)
-  {
-      Vector2 screenPosition = gesture.screenPosition;
-      control.GetParent().ScreenToLocal(mLocalPosition.x, mLocalPosition.y, screenPosition.x, screenPosition.y);
-      mShadowControl.SetPosition(mLocalPosition.x - mDragLocalPosition.x, mLocalPosition.y - mDragLocalPosition.y);
-  }
-  if(gesture.state == Gesture::Finished)
-  {
-    mDragControl.GetParent().Remove(mShadowControl);
-    EmitEndedSignal(control);
-  }
-}
-
-bool DragAndDropDetector::OnDrag(Dali::Actor actor, const Dali::TouchData& data)
-{
-  Dali::Toolkit::Control control = Dali::Toolkit::Control::DownCast(actor);
-  PointState::Type type = data.GetState(0);
-  if(type == PointState::DOWN)
-  {
     mPointDown = true;
     mDragControl = control;
     mFirstEnter.clear();
@@ -161,12 +141,29 @@ bool DragAndDropDetector::OnDrag(Dali::Actor actor, const Dali::TouchData& data)
     mShadowControl.SetPosition(actorPos);
     mShadowControl.SetSize(width, height);
     mShadowControl.SetBackgroundColor(Vector4(0.3f, 0.3f, 0.3f, 0.7f));
-    mShadowControl.SetParentOrigin(control.GetCurrentParentOrigin());
-    mShadowControl.SetAnchorPoint(control.GetCurrentAnchorPoint());
+    mShadowControl.SetProperty( Actor::Property::PARENT_ORIGIN, control.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ) );
+    mShadowControl.SetProperty( Actor::Property::ANCHOR_POINT,control.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ));
     control.GetParent().Add(mShadowControl);
-    SetPosition(data.GetScreenPosition(0));
+    SetPosition(gesture.screenPosition);
     EmitStartedSignal(control);
   }
+  if(gesture.state == Gesture::Continuing)
+  {
+      Vector2 screenPosition = gesture.screenPosition;
+      control.GetParent().ScreenToLocal(mLocalPosition.x, mLocalPosition.y, screenPosition.x, screenPosition.y);
+      mShadowControl.SetPosition(mLocalPosition.x - mDragLocalPosition.x, mLocalPosition.y - mDragLocalPosition.y);
+  }
+  if(gesture.state == Gesture::Finished)
+  {
+    mDragControl.GetParent().Remove(mShadowControl);
+    EmitEndedSignal(control);
+  }
+}
+
+bool DragAndDropDetector::OnDrag(Dali::Actor actor, const Dali::TouchData& data)
+{
+  Dali::Toolkit::Control control = Dali::Toolkit::Control::DownCast(actor);
+  PointState::Type type = data.GetState(0);
 
   if(type == PointState::MOTION)
   {
@@ -202,7 +199,7 @@ bool DragAndDropDetector::OnDrag(Dali::Actor actor, const Dali::TouchData& data)
     {
       SetPosition(data.GetScreenPosition(0));
       ClearContent();
-      SetContent(mDragControl.GetName());
+      SetContent(mDragControl.GetProperty< std::string >( Dali::Actor::Property::NAME ));
       EmitDroppedSignal(control);
     }