taskswitcher/taskswitcherui/taskswitcherapp/src/tsphysicsengine.cpp
branchRCL_3
changeset 12 9674c1a575e9
parent 11 ff572dfe6d86
child 26 1b758917cafc
equal deleted inserted replaced
11:ff572dfe6d86 12:9674c1a575e9
    84 TBool CTsPhysicsEngine::IsRunning() const
    84 TBool CTsPhysicsEngine::IsRunning() const
    85     {
    85     {
    86     return iPhysics->OngoingPhysicsAction() != CAknPhysics::EAknPhysicsActionNone;
    86     return iPhysics->OngoingPhysicsAction() != CAknPhysics::EAknPhysicsActionNone;
    87     }
    87     }
    88 
    88 
    89 
       
    90 // -----------------------------------------------------------------------------
       
    91 // CTsPhysicsEngine::IsDragging
       
    92 // -----------------------------------------------------------------------------
       
    93 //
       
    94 TBool CTsPhysicsEngine::IsDragging() const
       
    95     {
       
    96     return iPhysics->OngoingPhysicsAction() == CAknPhysics::EAknPhysicsActionDragging;
       
    97     }
       
    98 
       
    99 // -----------------------------------------------------------------------------
    89 // -----------------------------------------------------------------------------
   100 // CTsPhysicsEngine::HandleDragEvent
    90 // CTsPhysicsEngine::HandleDragEvent
   101 // -----------------------------------------------------------------------------
    91 // -----------------------------------------------------------------------------
   102 //
    92 //
   103 void CTsPhysicsEngine::HandleDragEvent(
    93 void CTsPhysicsEngine::HandleDragEvent(
   105     {
    95     {
   106     if (AknTouchGestureFw::EAknTouchGestureFwStart == aEvent.State())
    96     if (AknTouchGestureFw::EAknTouchGestureFwStart == aEvent.State())
   107         {
    97         {
   108         iPhysics->StopPhysics();
    98         iPhysics->StopPhysics();
   109         iStartTime.HomeTime();
    99         iStartTime.HomeTime();
       
   100         iStartPosition = aEvent.CurrentPosition();
       
   101         iDragDirection = 0;
   110         }
   102         }
   111     else if (AknTouchGestureFw::EAknTouchGestureFwOn == aEvent.State())
   103     else if (AknTouchGestureFw::EAknTouchGestureFwOn == aEvent.State())
   112         {
   104         {
       
   105         TInt direction =
       
   106                 aEvent.CurrentPosition().iX > aEvent.PreviousPosition().iX ? -1 : 1;
   113         TPoint deltaPoint(aEvent.PreviousPosition() - aEvent.CurrentPosition());
   107         TPoint deltaPoint(aEvent.PreviousPosition() - aEvent.CurrentPosition());
   114         iPhysics->RegisterPanningPosition(deltaPoint);
   108         iPhysics->RegisterPanningPosition(deltaPoint);
   115         iStartTime.HomeTime();
   109         if (iDragDirection && iDragDirection != direction)
       
   110             {
       
   111             iStartTime.HomeTime();
       
   112             iStartPosition = aEvent.PreviousPosition();
       
   113             }
       
   114         iDragDirection = direction;
   116         }
   115         }
   117     else //AknTouchGestureFw::EAknTouchGestureFwStop
   116     else //AknTouchGestureFw::EAknTouchGestureFwStop
   118         {
   117         {
   119         TPoint drag(aEvent.PreviousPosition() - aEvent.CurrentPosition());
   118         TPoint drag(iStartPosition - aEvent.CurrentPosition());
   120         iPhysics->StartPhysics(drag, iStartTime);
   119         iPhysics->StartPhysics(drag, iStartTime);
   121         }
   120         }
   122     }
   121     }
   123 
   122 
   124 // -----------------------------------------------------------------------------
   123 // -----------------------------------------------------------------------------